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/closeByVisitor.js

20 lines
661 B

import { Meteor } from 'meteor/meteor';
import { TAPi18n } from 'meteor/rocketchat:tap-i18n';
import { settings } from '../../../settings';
import { LivechatRooms, LivechatVisitors } from '../../../models';
import { Livechat } from '../lib/Livechat';
Meteor.methods({
'livechat:closeByVisitor'({ roomId, token }) {
const visitor = LivechatVisitors.getVisitorByToken(token);
const language = (visitor && visitor.language) || settings.get('Language') || 'en';
return Livechat.closeRoom({
visitor,
room: LivechatRooms.findOneOpenByRoomIdAndVisitorToken(roomId, token),
comment: TAPi18n.__('Closed_by_visitor', { lng: language }),
});
},
});