Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/livechat/server/api/lib/livechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export function settings(url) {
limitTextLength: initSettings.Livechat_enable_message_character_limit

&& (initSettings.Livechat_message_character_limit || initSettings.Message_MaxAllowedSize),
livechat_kill_switch: initSettings.Livechat_kill_switch,
livechat_kill_switch_message: initSettings.Livechat_kill_switch_message,
},
theme: {
title: initSettings.Livechat_title,
Expand Down
15 changes: 15 additions & 0 deletions app/livechat/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ Meteor.startup(function() {
public: true,
});

settings.add('Livechat_kill_switch', false, {
type: 'boolean',
group: 'Omnichannel',
section: 'Livechat',
public: true,
i18nDescription: 'Livechat_kill_switch_description',
});

settings.add('Livechat_kill_switch_message', 'Livechat is Currently Offline', {
type: 'string',
group: 'Omnichannel',
section: 'Livechat',
public: true,
});

settings.add('Livechat_title_color', '#C1272D', {
type: 'color',
editor: 'color',
Expand Down
8 changes: 8 additions & 0 deletions app/livechat/server/hooks/leadCapture.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

import { callbacks } from '../../../callbacks';
import { settings } from '../../../settings';
import { LivechatVisitors } from '../../../models';
Expand Down Expand Up @@ -45,3 +47,9 @@ callbacks.add('afterSaveMessage', function(message, room) {

return message;
}, callbacks.priority.LOW, 'leadCapture');

callbacks.add('beforeSaveMessage', function() {
if (settings.get('Livechat_kill_switch')) {
throw new Meteor.Error(settings.get('Livechat_kill_switch_message'));
}
}, callbacks.priority.LOW, 'leadCapture');
2 changes: 2 additions & 0 deletions app/livechat/server/lib/Livechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ export const Livechat = {
Settings.findNotHiddenPublic([
'Livechat_title',
'Livechat_title_color',
'Livechat_kill_switch',
'Livechat_kill_switch_message',
'Livechat_enable_message_character_limit',
'Livechat_message_character_limit',
'Message_MaxAllowedSize',
Expand Down
4 changes: 4 additions & 0 deletions app/livechat/server/lib/routing/AutoSelection.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { RoutingManager } from '../RoutingManager';
import { LivechatDepartmentAgents, Users } from '../../../../models/server';
import { settings } from '../../../../settings/server';

/* Auto Selection Queuing method:
*
Expand All @@ -20,6 +21,9 @@ class AutoSelection {
}

getNextAgent(department, ignoreAgentId) {
if (settings.get('Livechat_kill_switch')) {
return null;
}
if (department) {
return LivechatDepartmentAgents.getNextAgentForDepartment(department, ignoreAgentId);
}
Expand Down
3 changes: 3 additions & 0 deletions app/livechat/server/lib/routing/External.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class ExternalQueue {
}

getNextAgent(department, ignoreAgentId) {
if (settings.get('Livechat_kill_switch')) {
return null;
}
for (let i = 0; i < 10; i++) {
try {
let queryString = department ? `?departmentId=${ department }` : '';
Expand Down
2 changes: 2 additions & 0 deletions app/livechat/server/methods/getInitialData.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ Meteor.methods({
info.registrationFormMessage = initSettings.Livechat_registration_form_message;
info.showConnecting = initSettings.Livechat_Show_Connecting;
info.hideSysMessages = initSettings.Livechat_hide_sys_messages;
info.livechat_kill_switch = initSettings.Livechat_kill_switch;
info.livechat_kill_switch_message = initSettings.Livechat_kill_switch_message;

info.agentData = room && room[0] && room[0].servedBy && Users.getAgentInfo(room[0].servedBy._id);

Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2439,6 +2439,9 @@
"Livechat_guest_default_avatar": "Default Guest Avatar",
"Livechat_Inquiry_Already_Taken": "Omnichannel inquiry already taken",
"Livechat_Installation": "Livechat Installation",
"Livechat_kill_switch": "Emergency Livechat Shutdown",
"Livechat_kill_switch_description": "Temporarily Disable Livechat Communication with Agents",
"Livechat_kill_switch_message": "Emergency Livechat Shutdown Message",
"Livechat_last_chatted_agent_routing": "Last-Chatted Agent Preferred",
"Livechat_last_chatted_agent_routing_Description": "The Last-Chatted Agent setting allocates chats to the agent who previously interacted with the same visitor if the agent is available when the chat starts.",
"Livechat_managers": "Omnichannel managers",
Expand Down