Skip to content

Commit

Permalink
fix(controllers): update role check for mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Jan 30, 2025
1 parent 705ad42 commit c271111
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/v3/controllers/admin_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export const userUpdate = async (req: Request, res: Response) => {
const firstnameSaved = user.profile.firstname.value;
const rolesSave = user.profile.congregation?.cong_role || [];

const roleUpdate = roles.every((record) => rolesSave.some((role) => role === record));
const roleUpdate = roles.length === rolesSave.length && roles.every((record) => rolesSave.some((role) => role === record));

if (lastnameSaved !== lastname || firstnameSaved !== firstname || !roleUpdate) {
const profile = structuredClone(user.profile);
Expand Down

0 comments on commit c271111

Please sign in to comment.