Skip to content

Commit

Permalink
asd
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Feb 1, 2024
1 parent 44eb8ff commit 5d788ad
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions apps/meteor/app/slashcommands-unarchiveroom/server/server.ts
Expand Up @@ -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) {
Expand All @@ -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, {
Expand Down

0 comments on commit 5d788ad

Please sign in to comment.