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/server/methods/typingStatus.coffee

26 lines
648 B

Meteor.methods
typingStatus: (rid, start) ->
if not Meteor.userId()
throw new Meteor.Error('invalid-user', "[methods] typingStatus -> Invalid user")
console.log '[methods] typingStatus -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments
filter =
t: 't'
rid: rid
$and: [{'u._id': Meteor.userId()}]
if start
msgData =
'$set':
expireAt: moment().add(30, 'seconds').toDate()
'$setOnInsert':
msg: '...'
ts: moment().add(1, 'years').toDate()
'u._id': Meteor.userId()
'u.username': Meteor.user().username
ChatMessage.upsert(filter, msgData)
else
ChatMessage.remove(filter)