diff --git a/packages/rocketchat-slashcommands-unarchiveroom/server/server.js b/packages/rocketchat-slashcommands-unarchiveroom/server/server.js index a9884b870755..ae656cdd929e 100644 --- a/packages/rocketchat-slashcommands-unarchiveroom/server/server.js +++ b/packages/rocketchat-slashcommands-unarchiveroom/server/server.js @@ -14,13 +14,25 @@ function Unarchive(command, params, item) { room = RocketChat.models.Rooms.findOneByName(channel); } + const user = Meteor.users.findOne(Meteor.userId()); + + if (!room) { + return RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', { + _id: Random.id(), + rid: item.rid, + ts: new Date(), + msg: TAPi18n.__('Channel_doesnt_exist', { + postProcess: 'sprintf', + sprintf: [channel] + }, user.language) + }); + } + // You can not archive direct messages. if (room.t === 'd') { return; } - const user = Meteor.users.findOne(Meteor.userId()); - if (!room.archived) { RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', { _id: Random.id(),