Skip to content

Commit 20c0a4f

Browse files
committed
fix(pages): fix member self-remove
1 parent 8f77fbf commit 20c0a4f

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

apps/app-server/src/websocket/groups/change-user-role.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ export function registerGroupsChangeUserRole(
3939
await ctx.usingLocks(
4040
[
4141
[`user-lock:${ctx.userId}`],
42-
[`user-lock:${input.patientId}`],
42+
...(input.patientId !== ctx.userId
43+
? [[`user-lock:${input.patientId}`]]
44+
: []),
4345
[`group-lock:${input.groupId}`],
4446
],
4547
performCommunication,

apps/app-server/src/websocket/groups/remove-user.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ export function registerGroupsRemoveUser(fastify: ReturnType<typeof Fastify>) {
3636
await ctx.usingLocks(
3737
[
3838
[`user-lock:${ctx.userId}`],
39-
[`user-lock:${input.patientId}`],
39+
...(input.patientId !== ctx.userId
40+
? [[`user-lock:${input.patientId}`]]
41+
: []),
4042
[`group-lock:${input.groupId}`],
4143
],
4244
performCommunication,

apps/client/src/layouts/PagesLayout/RightSidebar/PageProperties/GroupSettingsDialog/MembersTab/MembersTab.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ async function removeSelectedUsers() {
244244
});
245245
}
246246
247-
await rotateGroupKeys({ groupId });
247+
if (canManageSelected.value) {
248+
await rotateGroupKeys({ groupId });
249+
}
248250
249251
if (finalSelectedUserIds.value.includes(authStore().userId)) {
250252
await removeGroupUser({

0 commit comments

Comments
 (0)