diff --git a/src/lib/db/group-store.ts b/src/lib/db/group-store.ts index 78913bd62c..63148aea5e 100644 --- a/src/lib/db/group-store.ts +++ b/src/lib/db/group-store.ts @@ -194,7 +194,7 @@ export default class GroupStore implements IGroupStore { userName: string, transaction?: Transaction, ): Promise { - const rows = users.map((user) => { + const rows = (users || []).map((user) => { return { group_id: groupId, user_id: user.user.id, @@ -219,7 +219,6 @@ export default class GroupStore implements IGroupStore { async updateGroupUsers( groupId: number, newUsers: IGroupUserModel[], - existingUsers: IGroupUserModel[], deletableUsers: IGroupUser[], userName: string, ): Promise { diff --git a/src/lib/services/group-service.ts b/src/lib/services/group-service.ts index d7c646f5eb..53f5af51d2 100644 --- a/src/lib/services/group-service.ts +++ b/src/lib/services/group-service.ts @@ -119,18 +119,12 @@ export class GroupService { (groupUser) => groupUser.user.id == existingUser.userId, ), ); - const deletableUserIds = deletableUsers.map((g) => g.userId); await this.groupStore.updateGroupUsers( newGroup.id, group.users.filter( (user) => !existingUserIds.includes(user.user.id), ), - group.users.filter( - (user) => - existingUserIds.includes(user.user.id) && - !deletableUserIds.includes(user.user.id), - ), deletableUsers, userName, ); diff --git a/src/lib/types/stores/group-store.ts b/src/lib/types/stores/group-store.ts index 2c955221e6..e9a5adcc6f 100644 --- a/src/lib/types/stores/group-store.ts +++ b/src/lib/types/stores/group-store.ts @@ -39,7 +39,6 @@ export interface IGroupStore extends Store { updateGroupUsers( groupId: number, newUsers: IGroupUserModel[], - existingUsers: IGroupUserModel[], deletableUsers: IGroupUser[], userName: string, ): Promise; diff --git a/src/test/fixtures/fake-group-store.ts b/src/test/fixtures/fake-group-store.ts index 59bc9f2b1e..dbf4d323a3 100644 --- a/src/test/fixtures/fake-group-store.ts +++ b/src/test/fixtures/fake-group-store.ts @@ -69,7 +69,6 @@ export default class FakeGroupStore implements IGroupStore { updateGroupUsers( groupId: number, newUsers: IGroupUserModel[], - existingUsers: IGroupUserModel[], deletableUsers: IGroupUser[], userName: string, ): Promise {