diff --git a/app/livechat/client/views/app/livechatAppearance.js b/app/livechat/client/views/app/livechatAppearance.js
index 6fcca80a9e1b..e33662678024 100644
--- a/app/livechat/client/views/app/livechatAppearance.js
+++ b/app/livechat/client/views/app/livechatAppearance.js
@@ -11,6 +11,19 @@ import { APIClient } from '../../../../utils/client';
const getSettingFromAppearance = (instance, settingName) => instance.appearance.get() && instance.appearance.get().find((setting) => setting._id === settingName);
Template.livechatAppearance.helpers({
+ showLimitTextLengthFormTrueChecked() {
+ if (Template.instance().showLimitTextLength.get()) {
+ return 'checked';
+ }
+ },
+ showLimitTextLengthFormFalseChecked() {
+ if (!Template.instance().showLimitTextLength.get()) {
+ return 'checked';
+ }
+ },
+ limitTextLength() {
+ return Template.instance().limitTextLength.get();
+ },
color() {
return Template.instance().color.get();
},
@@ -110,7 +123,8 @@ Template.livechatAppearance.onCreated(async function() {
this.appearance = new ReactiveVar([]);
this.title = new ReactiveVar(null);
this.color = new ReactiveVar(null);
-
+ this.showLimitTextLength = new ReactiveVar(null);
+ this.limitTextLength = new ReactiveVar(null);
this.showAgentInfo = new ReactiveVar(null);
this.showAgentEmail = new ReactiveVar(null);
this.displayOfflineForm = new ReactiveVar(null);
@@ -132,6 +146,8 @@ Template.livechatAppearance.onCreated(async function() {
const livechatTitle = getSettingFromAppearance(this, 'Livechat_title');
const livechatTitleColor = getSettingFromAppearance(this, 'Livechat_title_color');
+ const livechatShowMessageCharacterLimit = getSettingFromAppearance(this, 'Livechat_enable_message_character_limit');
+ const livechatMessageCharacterLimit = getSettingFromAppearance(this, 'Livechat_message_character_limit');
const livechatShowAgentInfo = getSettingFromAppearance(this, 'Livechat_show_agent_info');
const livechatShowAgentEmail = getSettingFromAppearance(this, 'Livechat_show_agent_email');
const livechatDisplayOfflineForm = getSettingFromAppearance(this, 'Livechat_display_offline_form');
@@ -150,6 +166,8 @@ Template.livechatAppearance.onCreated(async function() {
this.title.set(livechatTitle && livechatTitle.value);
this.color.set(livechatTitleColor && livechatTitleColor.value);
+ this.showLimitTextLength.set(livechatShowMessageCharacterLimit && livechatShowMessageCharacterLimit.value);
+ this.limitTextLength.set(livechatMessageCharacterLimit && livechatMessageCharacterLimit.value);
this.showAgentInfo.set(livechatShowAgentInfo && livechatShowAgentInfo.value);
this.showAgentEmail.set(livechatShowAgentEmail && livechatShowAgentEmail.value);
this.displayOfflineForm.set(livechatDisplayOfflineForm && livechatDisplayOfflineForm.value);
@@ -187,6 +205,12 @@ Template.livechatAppearance.events({
const settingTitleColor = getSettingFromAppearance(instance, 'Livechat_title_color');
instance.color.set(settingTitleColor && settingTitleColor.value);
+ const settinglivechatShowMessageCharacterLimit = getSettingFromAppearance(instance, 'Livechat_enable_message_character_limit');
+ instance.showLimitTextLength.set(settinglivechatShowMessageCharacterLimit && settinglivechatShowMessageCharacterLimit.value);
+
+ const settinglivechatMessageCharacterLimit = getSettingFromAppearance(instance, 'Livechat_message_character_limit');
+ instance.limitTextLength.set(settinglivechatMessageCharacterLimit && settinglivechatMessageCharacterLimit.value);
+
const settingShowAgentInfo = getSettingFromAppearance(instance, 'Livechat_show_agent_info');
instance.showAgentInfo.set(settingShowAgentInfo && settingShowAgentInfo.value);
@@ -240,6 +264,14 @@ Template.livechatAppearance.events({
_id: 'Livechat_title_color',
value: instance.color.get(),
},
+ {
+ _id: 'Livechat_enable_message_character_limit',
+ value: instance.showLimitTextLength.get(),
+ },
+ {
+ _id: 'Livechat_message_character_limit',
+ value: parseInt(instance.limitTextLength.get()),
+ },
{
_id: 'Livechat_show_agent_info',
value: instance.showAgentInfo.get(),
diff --git a/app/livechat/server/api/lib/appearance.js b/app/livechat/server/api/lib/appearance.js
index 8d2f6b79963c..12798f0de52c 100644
--- a/app/livechat/server/api/lib/appearance.js
+++ b/app/livechat/server/api/lib/appearance.js
@@ -10,6 +10,8 @@ export async function findAppearance({ userId }) {
$in: [
'Livechat_title',
'Livechat_title_color',
+ 'Livechat_enable_message_character_limit',
+ 'Livechat_message_character_limit',
'Livechat_show_agent_info',
'Livechat_show_agent_email',
'Livechat_display_offline_form',
diff --git a/app/livechat/server/api/lib/livechat.js b/app/livechat/server/api/lib/livechat.js
index 4626ce819b35..bb4a7b4bb75f 100644
--- a/app/livechat/server/api/lib/livechat.js
+++ b/app/livechat/server/api/lib/livechat.js
@@ -94,7 +94,6 @@ export function settings() {
const departments = findDepartments();
const sound = `${ Meteor.absoluteUrl() }sounds/chime.mp3`;
const emojis = Meteor.call('listEmojiCustom');
-
return {
enabled: initSettings.Livechat_enabled,
settings: {
@@ -111,6 +110,8 @@ export function settings() {
forceAcceptDataProcessingConsent: initSettings.Livechat_force_accept_data_processing_consent,
showConnecting: initSettings.Livechat_Show_Connecting,
agentHiddenInfo: initSettings.Livechat_show_agent_info === false,
+ limitTextLength: initSettings.Livechat_enable_message_character_limit
+ && (initSettings.Livechat_message_character_limit || initSettings.Message_MaxAllowedSize),
},
theme: {
title: initSettings.Livechat_title,
diff --git a/app/livechat/server/config.js b/app/livechat/server/config.js
index 780425f68b29..2b59ad4d7772 100644
--- a/app/livechat/server/config.js
+++ b/app/livechat/server/config.js
@@ -27,6 +27,20 @@ Meteor.startup(function() {
public: true,
});
+ settings.add('Livechat_enable_message_character_limit', false, {
+ type: 'boolean',
+ group: 'Omnichannel',
+ section: 'Livechat',
+ public: true,
+ });
+
+ settings.add('Livechat_message_character_limit', 0, {
+ type: 'int',
+ group: 'Omnichannel',
+ section: 'Livechat',
+ public: true,
+ });
+
settings.add('Livechat_display_offline_form', true, {
type: 'boolean',
group: 'Omnichannel',
diff --git a/app/livechat/server/lib/Livechat.js b/app/livechat/server/lib/Livechat.js
index 0fe3480aa77d..69bfee85c89d 100644
--- a/app/livechat/server/lib/Livechat.js
+++ b/app/livechat/server/lib/Livechat.js
@@ -428,6 +428,9 @@ export const Livechat = {
Settings.findNotHiddenPublic([
'Livechat_title',
'Livechat_title_color',
+ 'Livechat_enable_message_character_limit',
+ 'Livechat_message_character_limit',
+ 'Message_MaxAllowedSize',
'Livechat_enabled',
'Livechat_registration_form',
'Livechat_allow_switching_departments',
diff --git a/app/livechat/server/methods/saveAppearance.js b/app/livechat/server/methods/saveAppearance.js
index 99e57ce6ef2e..44a3749d81b4 100644
--- a/app/livechat/server/methods/saveAppearance.js
+++ b/app/livechat/server/methods/saveAppearance.js
@@ -12,6 +12,8 @@ Meteor.methods({
const validSettings = [
'Livechat_title',
'Livechat_title_color',
+ 'Livechat_enable_message_character_limit',
+ 'Livechat_message_character_limit',
'Livechat_show_agent_info',
'Livechat_show_agent_email',
'Livechat_display_offline_form',
diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json
index aef424a52dbf..f7669b35057c 100644
--- a/packages/rocketchat-i18n/i18n/en.i18n.json
+++ b/packages/rocketchat-i18n/i18n/en.i18n.json
@@ -2272,6 +2272,8 @@
"Livechat_Take_Confirm": "Do you want to take this client?",
"Livechat_title": "Livechat Title",
"Livechat_title_color": "Livechat Title Background Color",
+ "Livechat_enable_message_character_limit": "Enable message character limit",
+ "Livechat_message_character_limit": "Livechat message character limit",
"Livechat_transcript_already_requested_warning": "The transcript of this chat has already been requested and will be sent as soon as the conversation ends.",
"Livechat_transcript_request_has_been_canceled": "The chat transcription request has been canceled.",
"Livechat_transcript_has_been_requested": "The chat transcript has been requested.",
@@ -2443,6 +2445,7 @@
"Message_AudioRecorderEnabled_Description": "Requires 'audio/mp3' files to be an accepted media type within 'File Upload' settings.",
"Message_BadWordsFilterList": "Add Bad Words to the Blacklist",
"Message_BadWordsFilterListDescription": "Add List of Comma-separated list of bad words to filter",
+ "Message_Characther_Limit": "Message Characther Limit",
"MessageBox_view_mode": "MessageBox View Mode",
"message_counter": "__counter__ message",
"message_counter_plural": "__counter__ messages",
diff --git a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
index bdd58b9d87e3..11c41c103317 100644
--- a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
+++ b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
@@ -2016,6 +2016,8 @@
"Livechat_Take_Confirm": "Você quer levar esse cliente?",
"Livechat_title": "Título Livechat",
"Livechat_title_color": "Cor de fundo do título do Livechat",
+ "Livechat_enable_message_character_limit": "Habilitar Limite de caracteres de mensagem",
+ "Livechat_message_character_limit": "Limite de caracteres da mensagem no livechat",
"Livechat_transcript_already_requested_warning": "A transcrição deste bate-papo já foi solicitada e será enviada assim que a conversa for encerrada.",
"Livechat_transcript_request_has_been_canceled": "A requisição de transcrição do bate-papo foi cancelada.",
"Livechat_transcript_has_been_requested": "A transcrição do bate-papo foi requisitada.",
@@ -2168,6 +2170,7 @@
"Message_AudioRecorderEnabled_Description": "Requer arquivos 'audio / mp3' para ser um tipo de mídia aceito dentro das configurações 'Upload de arquivo'.",
"Message_BadWordsFilterList": "Adicione palavrões para a lista negra",
"Message_BadWordsFilterListDescription": "Adicione palavrões separados por vírgula para filtrar",
+ "Message_Characther_Limit": "Limite do caráter da mensagem",
"message_counter": "__counter__ mensagem",
"message_counter_plural": "__counter__ mensagens",
"Message_DateFormat": "Formato de Data",
diff --git a/packages/rocketchat-i18n/i18n/pt.i18n.json b/packages/rocketchat-i18n/i18n/pt.i18n.json
index 19ea03e9b024..9d02000779f0 100644
--- a/packages/rocketchat-i18n/i18n/pt.i18n.json
+++ b/packages/rocketchat-i18n/i18n/pt.i18n.json
@@ -1894,6 +1894,8 @@
"Livechat_Take_Confirm": "Quer levar este cliente?",
"Livechat_title": "Título Livechat",
"Livechat_title_color": "Cor de fundo do título do Livechat",
+ "Livechat_enable_message_character_limit": "Habilitar Limite de caracteres de mensagem",
+ "Livechat_message_character_limit": "Limite de caracteres da mensagem no livechat",
"Livechat_transcript_sent": "Transcrição de Livechat enviada",
"Livechat_Users": "Utilizadores Livechat",
"LiveStream & Broadcasting": "Livestream e Broadcasting",
@@ -2021,6 +2023,7 @@
"Message_AudioRecorderEnabled_Description": "Requer arquivos 'áudio / mp3' para ser um tipo de leitor aceite dentro das configurações 'Carregar ficheiro'.",
"Message_BadWordsFilterList": "Adicione palavrões para a lista negra",
"Message_BadWordsFilterListDescription": "Adicione palavrões separados por vírgula para filtrar",
+ "Message_Characther_Limit": "Limite do caráter da mensagem",
"Message_DateFormat": "Formato de Data",
"Message_DateFormat_Description": "Veja também:
Moment.js",
"Message_deleting_blocked": "Esta mensagem não pode ser mais apagada",