Skip to content

Commit

Permalink
undo allowMemberAction
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Mar 23, 2023
1 parent 6e8ee69 commit c38c08b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/meteor/definition/IRoomTypeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export interface IRoomTypeServerDirectives {
config: IRoomTypeConfig;

allowRoomSettingChange: (room: IRoom, setting: ValueOf<typeof RoomSettingsEnum>) => boolean;
allowMemberAction: (room: IRoom, action: ValueOf<typeof RoomMemberActions>, userId?: IUser['_id']) => Promise<boolean>;
allowMemberAction: (room: IRoom, action: ValueOf<typeof RoomMemberActions>, userId?: IUser['_id']) => boolean;
roomName: (room: IRoom, userId?: string) => string | undefined;
isGroupChat: (room: IRoom) => boolean;
canBeDeleted: (hasPermission: (permissionId: string, rid?: string) => Promise<boolean> | boolean, room: IRoom) => Promise<boolean>;
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/server/lib/rooms/roomCoordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RoomCoordinatorServer extends RoomCoordinator {
allowRoomSettingChange(_room: IRoom, _setting: ValueOf<typeof RoomSettingsEnum>) {
return true;
},
async allowMemberAction(_room: IRoom, _action: ValueOf<typeof RoomMemberActions>, _userId?: IUser['_id']): Promise<boolean> {
allowMemberAction(_room: IRoom, _action: ValueOf<typeof RoomMemberActions>, _userId?: IUser['_id']): boolean {
return false;
},
roomName(_room: IRoom, _userId?: string): string {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/server/lib/rooms/roomTypes/direct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/server/lib/rooms/roomTypes/livechat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ roomCoordinator.add(LivechatRoomType, {
}
},

async allowMemberAction(_room, action) {
allowMemberAction(_room, action) {
return ([RoomMemberActions.INVITE, RoomMemberActions.JOIN] as Array<ValueOf<typeof RoomMemberActions>>).includes(action);
},

Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/server/lib/rooms/roomTypes/private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/server/lib/rooms/roomTypes/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c38c08b

Please sign in to comment.