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

30 lines
751 B

import { Meteor } from 'meteor/meteor';
import { settings } from '../../settings';
import { ChatMessage, Subscriptions } from '../../models';
Meteor.methods({
snippetMessage(message) {
if (typeof Meteor.userId() === 'undefined' || Meteor.userId() === null) {
return false;
}
if ((typeof settings.get('Message_AllowSnippeting') === 'undefined')
|| (settings.get('Message_AllowSnippeting') === null)
|| (settings.get('Message_AllowSnippeting') === false)) {
return false;
}
const subscription = Subscriptions.findOne({ rid: message.rid, 'u._id': Meteor.userId() });
if (subscription === undefined) {
return false;
}
ChatMessage.update({
_id: message._id,
}, {
$set: {
snippeted: true,
},
});
},
});