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/livechat/server/methods/setCustomField.js

18 lines
543 B

import { Meteor } from 'meteor/meteor';
import { LivechatRooms, LivechatVisitors, LivechatCustomField } from '../../../models';
Meteor.methods({
'livechat:setCustomField'(token, key, value, overwrite = true) {
const customField = LivechatCustomField.findOneById(key);
if (customField) {
if (customField.scope === 'room') {
return LivechatRooms.updateDataByToken(token, key, value, overwrite);
}
// Save in user
return LivechatVisitors.updateLivechatDataByToken(token, key, value, overwrite);
}
return true;
},
});