Skip to content

Commit

Permalink
[frontend] Authorized members default value should not add me user (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Archidoit committed Sep 13, 2024
1 parent 59829af commit 042bfc3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import SelectField from '../../../../components/fields/SelectField';
import { useFormatter } from '../../../../components/i18n';
import { AccessRight, ALL_MEMBERS_AUTHORIZED_CONFIG, AuthorizedMemberOption, Creator, CREATOR_AUTHORIZED_CONFIG } from '../../../../utils/authorizedMembers';
import SwitchField from '../../../../components/fields/SwitchField';
import useAuth from '../../../../utils/hooks/useAuth';

/**
* Returns true if the authorized member option is generic.
Expand Down Expand Up @@ -75,7 +74,6 @@ const AuthorizedMembersField = ({
canDeactivate = false,
}: AuthorizedMembersFieldProps) => {
const { t_i18n } = useFormatter();
const { me } = useAuth();
const { setFieldValue } = form;
const { name, value } = field;

Expand Down Expand Up @@ -177,14 +175,6 @@ const AuthorizedMembersField = ({
accessRight: 'admin',
});
}
if (me.id !== owner?.id) {
values.push({
label: me.name,
type: 'User',
value: me.id,
accessRight: 'admin',
});
}
setFieldValue(name, values);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ const EntitySettingAttributeEdition = ({
// due to the fact that this component managed all types of fields and this
// query is used only for one particular case.
const data = (await fetchQuery(entitySettingAttributeEditionMembersQuery, {
filters: {
filters: defaultAuthorizedMembers.length > 0 ? {
mode: 'and',
filters: [{
key: 'ids',
values: defaultAuthorizedMembers.map((m) => m.id),
}],
filterGroups: [],
},
} : undefined,
}).toPromise()) as EntitySettingAttributeEditionMembersQuery$data;
setMembersData(data);
};
Expand Down

0 comments on commit 042bfc3

Please sign in to comment.