From 4eb3529b72d4c5f25e9466f22e4154585c315137 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Thu, 23 Mar 2023 18:53:31 -0300 Subject: [PATCH] undo allowMemberAction --- apps/meteor/definition/IRoomTypeConfig.ts | 2 +- apps/meteor/server/lib/rooms/roomTypes/direct.ts | 2 +- apps/meteor/server/lib/rooms/roomTypes/livechat.ts | 2 +- apps/meteor/server/lib/rooms/roomTypes/private.ts | 4 ++-- apps/meteor/server/lib/rooms/roomTypes/public.ts | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/meteor/definition/IRoomTypeConfig.ts b/apps/meteor/definition/IRoomTypeConfig.ts index 59b506e3cd961..27b30ab38465a 100644 --- a/apps/meteor/definition/IRoomTypeConfig.ts +++ b/apps/meteor/definition/IRoomTypeConfig.ts @@ -99,7 +99,7 @@ export interface IRoomTypeServerDirectives { config: IRoomTypeConfig; allowRoomSettingChange: (room: IRoom, setting: ValueOf) => boolean; - allowMemberAction: (room: IRoom, action: ValueOf, userId?: IUser['_id']) => Promise; + allowMemberAction: (room: IRoom, action: ValueOf, userId?: IUser['_id']) => boolean; roomName: (room: IRoom, userId?: string) => string | undefined; isGroupChat: (room: IRoom) => boolean; canBeDeleted: (hasPermission: (permissionId: string, rid?: string) => Promise | boolean, room: IRoom) => Promise; diff --git a/apps/meteor/server/lib/rooms/roomTypes/direct.ts b/apps/meteor/server/lib/rooms/roomTypes/direct.ts index 698f445809494..ce88c5012e914 100644 --- a/apps/meteor/server/lib/rooms/roomTypes/direct.ts +++ b/apps/meteor/server/lib/rooms/roomTypes/direct.ts @@ -44,7 +44,7 @@ roomCoordinator.add(DirectMessageRoomType, { allowMemberAction(room: IRoom, action, userId) { if (isRoomFederated(room)) { - return Federation.actionAllowed(room, action, userId); + return Promise.await(Federation.actionAllowed(room, action, userId)); } switch (action) { case RoomMemberActions.BLOCK: diff --git a/apps/meteor/server/lib/rooms/roomTypes/livechat.ts b/apps/meteor/server/lib/rooms/roomTypes/livechat.ts index 4a30cd2e151c9..bcfe935db4c3e 100644 --- a/apps/meteor/server/lib/rooms/roomTypes/livechat.ts +++ b/apps/meteor/server/lib/rooms/roomTypes/livechat.ts @@ -19,7 +19,7 @@ roomCoordinator.add(LivechatRoomType, { } }, - async allowMemberAction(_room, action) { + allowMemberAction(_room, action) { return ([RoomMemberActions.INVITE, RoomMemberActions.JOIN] as Array>).includes(action); }, diff --git a/apps/meteor/server/lib/rooms/roomTypes/private.ts b/apps/meteor/server/lib/rooms/roomTypes/private.ts index 665f6b7a1c535..050bae1a96da7 100644 --- a/apps/meteor/server/lib/rooms/roomTypes/private.ts +++ b/apps/meteor/server/lib/rooms/roomTypes/private.ts @@ -31,9 +31,9 @@ roomCoordinator.add(PrivateRoomType, { } }, - async allowMemberAction(_room, action, userId) { + allowMemberAction(_room, action, userId) { if (isRoomFederated(_room as IRoom)) { - return Federation.actionAllowed(_room, action, userId); + return Promise.await(Federation.actionAllowed(_room, action, userId)); } switch (action) { case RoomMemberActions.BLOCK: diff --git a/apps/meteor/server/lib/rooms/roomTypes/public.ts b/apps/meteor/server/lib/rooms/roomTypes/public.ts index 5f73674d97360..2d143adae54cc 100644 --- a/apps/meteor/server/lib/rooms/roomTypes/public.ts +++ b/apps/meteor/server/lib/rooms/roomTypes/public.ts @@ -31,9 +31,9 @@ roomCoordinator.add(PublicRoomType, { } }, - allowMemberAction(_room, action, userId) { + allowMemberAction(_room, action, userId): boolean { if (isRoomFederated(_room as IRoom)) { - return Federation.actionAllowed(_room, action, userId); + return Promise.await(Federation.actionAllowed(_room, action, userId)); } switch (action) { case RoomMemberActions.BLOCK: