The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/methods/deleteMessage.coffee

17 lines
583 B

Meteor.methods
deleteMessage: (message) ->
if not Meteor.userId()
throw new Meteor.Error 203, t('general.User_logged_out')
hasPermission = RocketChat.authz.hasAtLeastOnePermission('delete-message', message.rid)
deleteAllowed = RocketChat.settings.get 'Message_AllowDeleting'
deleteOwn = message?.u?._id is Meteor.userId()
unless hasPermission or (deleteAllowed and deleteOwn)
throw new Meteor.Error 'message-deleting-not-allowed', t('Message_deleting_not_allowed')
Tracker.nonreactive ->
ChatMessage.remove
_id: message._id
'u._id': Meteor.userId()