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/pinMessage.coffee

21 lines
585 B

Meteor.methods
pinMessage: (message) ->
if not Meteor.userId()
throw new Meteor.Error 203, t('User_logged_out')
if not RocketChat.settings.get 'Message_AllowPinning'
throw new Meteor.Error 'message-pinning-not-allowed', t('Message_pinning_not_allowed')
Tracker.nonreactive ->
message.pts = new Date(Date.now() + TimeSync.serverOffset())
message.pinned = true
message = RocketChat.callbacks.run 'beforeSaveMessage', message
ChatMessage.update
_id: message.id
'u._id': Meteor.userId()
,
$set:
pinned: message.pinned
pts: message.pts