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/packages/rocketchat-message-snippet/client/snippetMessage.js

24 lines
659 B

Meteor.methods({
snippetMessage: function(message) {
if (typeof Meteor.userId() == "undefined" || Meteor.userId() == null) {
return false;
}
if ((typeof RocketChat.settings.get('Message_AllowSnippeting') == "undefined") || (
RocketChat.settings.get('Message_AllowSnippeting') == null)) {
return false;
}
let room = RocketChat.models.Rooms.findOne({ _id: message.rid });
if (Array.isArray(room.usernames) && room.usernames.indexOf(Meteor.user().username) == -1) {
return false;
}
ChatMessage.update({
_id: message._id,
}, {
$set: {
snippeted: true
}
});
}
});