From 5d788add5dea1f9d21f0e50a90947a5540eb9c76 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Wed, 31 Jan 2024 23:25:51 -0300 Subject: [PATCH] asd --- .../slashcommands-unarchiveroom/server/server.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/apps/meteor/app/slashcommands-unarchiveroom/server/server.ts b/apps/meteor/app/slashcommands-unarchiveroom/server/server.ts index 211f11b4b21e9..abfc48fd28893 100644 --- a/apps/meteor/app/slashcommands-unarchiveroom/server/server.ts +++ b/apps/meteor/app/slashcommands-unarchiveroom/server/server.ts @@ -48,9 +48,12 @@ slashCommands.add({ return; } - // You can not archive direct messages. if (!(await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId))) { - return; + throw new Meteor.Error('error-direct-message-room', `rooms type: ${room.t} can not be unarchive`, { method: 'unarchiveRoom' }); + } + + if (!(await hasPermissionAsync(userId, 'unarchive-room', room._id))) { + throw new Meteor.Error('error-not-authorized', 'Not authorized', { method: 'unarchiveRoom' }); } if (!room.archived) { @@ -64,14 +67,6 @@ slashCommands.add({ return; } - if (!(await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId))) { - throw new Meteor.Error('error-direct-message-room', `rooms type: ${room.t} can not be unarchive`, { method: 'unarchiveRoom' }); - } - - if (!(await hasPermissionAsync(userId, 'unarchive-room', room._id))) { - throw new Meteor.Error('error-not-authorized', 'Not authorized', { method: 'unarchiveRoom' }); - } - await unarchiveRoom(room._id, user); void api.broadcast('notify.ephemeralMessage', userId, message.rid, {