Skip to content

Commit

Permalink
remove permission feature flag (#1516)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjosttveit authored Sep 28, 2023
1 parent c1b62fa commit f1d4ac5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 24 deletions.
1 change: 0 additions & 1 deletion src/features/applicationMetadata/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@ export interface IGetApplicationMetadataRejected {

export interface IBackendFeaturesState {
multiPartSave: boolean;
processActions: boolean;
jsonObjectInDataResponse: boolean; // Extended attachment validation
}
11 changes: 2 additions & 9 deletions src/features/confirm/components/ConfirmButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ import type { BaseButtonProps } from 'src/layout/Button/WrappedButton';
export const ConfirmButton = (props: Omit<BaseButtonProps, 'onClick'> & { id: string }) => {
const confirmingId = useAppSelector((state) => state.process.completingId);
const [validateId, setValidateId] = useState<string | null>(null);
const processActionsFeature = useAppSelector(
(state) => state.applicationMetadata.applicationMetadata?.features?.processActions,
);
const { actions } = useAppSelector((state) => state.process);
const disabled = processActionsFeature && !actions?.confirm;
const disabled = !actions?.confirm;
const resolvedNodes = useExprContext();

const dispatch = useAppDispatch();
Expand All @@ -42,11 +39,7 @@ export const ConfirmButton = (props: Omit<BaseButtonProps, 'onClick'> & { id: st
}),
);
if (serverValidations.length === 0) {
if (processActionsFeature) {
dispatch(ProcessActions.complete({ componentId: props.id, action: 'confirm' }));
} else {
dispatch(ProcessActions.complete({ componentId: props.id }));
}
dispatch(ProcessActions.complete({ componentId: props.id, action: 'confirm' }));
}
})
.catch((error) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type { IGetProcessStateFulfilled, IProcessPermissions } from 'src/feature
import type { ProcessTaskType } from 'src/types';

export const PermissionsEditor = () => {
const shouldShow = useAppSelector((state) => state.applicationMetadata.applicationMetadata?.features?.processActions);
const { read, write, actions, taskType, taskId } = useAppSelector((state) => state.process);
const dispatch = useDispatch();

Expand All @@ -30,10 +29,6 @@ export const PermissionsEditor = () => {
dispatch(FormLayoutActions.updateLayouts({}));
}

if (!shouldShow) {
return null;
}

return (
<Checkbox.Group
legend='Policy'
Expand Down
11 changes: 2 additions & 9 deletions src/layout/Button/ButtonComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,11 @@ export const ButtonComponent = ({ node, ...componentProps }: IButtonReceivedProp

const dispatch = useAppDispatch();
const currentTaskType = useAppSelector((state) => state.instanceData.instance?.process?.currentTask?.altinnTaskType);
const processActionsFeature = useAppSelector(
(state) => state.applicationMetadata.applicationMetadata?.features?.processActions,
);
const { actions, write } = useAppSelector((state) => state.process);
const { canSubmit, busyWithId, message } = useCanSubmitForm();

const disabled =
!canSubmit ||
(processActionsFeature &&
((currentTaskType === 'data' && !write) || (currentTaskType === 'confirmation' && !actions?.confirm)));
!canSubmit || (currentTaskType === 'data' && !write) || (currentTaskType === 'confirmation' && !actions?.confirm);

const parentIsPage = node.parent instanceof LayoutPage;

Expand All @@ -60,10 +55,8 @@ export const ButtonComponent = ({ node, ...componentProps }: IButtonReceivedProp
componentId,
}),
);
} else if (currentTaskType === 'confirmation' && processActionsFeature) {
} else if (currentTaskType === 'confirmation') {
dispatch(ProcessActions.complete({ componentId, action: 'confirm' }));
} else {
dispatch(ProcessActions.complete({ componentId }));
}
}
};
Expand Down

0 comments on commit f1d4ac5

Please sign in to comment.