parent
aace1ad7dc
commit
34e32e1413
@ -1,21 +0,0 @@ |
||||
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 |
||||
@ -1,21 +0,0 @@ |
||||
Meteor.methods |
||||
unpinMessage: (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 = false |
||||
message = RocketChat.callbacks.run 'beforeSaveMessage', message |
||||
|
||||
ChatMessage.update |
||||
_id: message.id |
||||
'u._id': Meteor.userId() |
||||
, |
||||
$set: |
||||
pinned: message.pinned |
||||
pts: message.pts |
||||
@ -0,0 +1,26 @@ |
||||
Meteor.methods |
||||
pinMessage: (message) -> |
||||
if not Meteor.userId() |
||||
throw new Meteor.Error('invalid-user', "[methods] pinMessage -> Invalid user") |
||||
|
||||
if not RocketChat.settings.get 'Message_AllowPinning' |
||||
throw new Meteor.Error 'message-pinning-not-allowed', '[methods] pinMessage -> Message pinning not allowed' |
||||
|
||||
|
||||
ChatMessage.update |
||||
_id: message._id |
||||
, |
||||
$set: { pinned: true } |
||||
|
||||
unpinMessage: (message) -> |
||||
if not Meteor.userId() |
||||
throw new Meteor.Error('invalid-user', "[methods] pinMessage -> Invalid user") |
||||
|
||||
if not RocketChat.settings.get 'Message_AllowPinning' |
||||
throw new Meteor.Error 'message-pinning-not-allowed', '[methods] pinMessage -> Message pinning not allowed' |
||||
|
||||
|
||||
ChatMessage.update |
||||
_id: message._id |
||||
, |
||||
$set: { pinned: false } |
||||
Loading…
Reference in new issue