From 5c6e64cbe18cb8f58894a0c80f00afd14202e58b Mon Sep 17 00:00:00 2001 From: yash-rajpal Date: Sun, 24 Jan 2021 19:17:22 +0530 Subject: [PATCH 1/5] Changed broken link for english --- packages/rocketchat-i18n/i18n/en.i18n.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 4bb88308608e..62278257899d 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -3252,7 +3252,7 @@ "RetentionPolicyRoom_FilesOnly": "Prune files only, keep messages", "RetentionPolicyRoom_MaxAge": "Maximum message age in days (default: __max__)", "RetentionPolicyRoom_OverrideGlobal": "Override global retention policy", - "RetentionPolicyRoom_ReadTheDocs": "Watch out! Tweaking these settings without utmost care can destroy all message history. Please read the documentation before turning the feature on here.", + "RetentionPolicyRoom_ReadTheDocs": "Watch out! Tweaking these settings without utmost care can destroy all message history. Please read the documentation before turning the feature on here.", "Retry_Count": "Retry Count", "Return_to_home": "Return to home", "Return_to_previous_page": "Return to previous page", From 1c1ea13dae3961ecd6a720dc4db1722863a67e92 Mon Sep 17 00:00:00 2001 From: yash-rajpal Date: Mon, 25 Jan 2021 09:50:33 +0530 Subject: [PATCH 2/5] checking msg len in api call --- app/livechat/server/api/v1/message.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/livechat/server/api/v1/message.js b/app/livechat/server/api/v1/message.js index 68a83706fc18..89e830d81f40 100644 --- a/app/livechat/server/api/v1/message.js +++ b/app/livechat/server/api/v1/message.js @@ -9,6 +9,7 @@ import { loadMessageHistory } from '../../../../lib'; import { findGuest, findRoom, normalizeHttpHeaderData } from '../lib/livechat'; import { Livechat } from '../../lib/Livechat'; import { normalizeMessageFileUpload } from '../../../../utils/server/functions/normalizeMessageFileUpload'; +import { settings } from '../../../../../app/settings/server'; API.v1.addRoute('livechat/message', { post() { @@ -40,6 +41,13 @@ API.v1.addRoute('livechat/message', { throw new Meteor.Error('room-closed'); } + if(settings.get('Livechat_enable_message_character_limit')) { + if(msg.length > parseInt(settings.get('Livechat_message_character_limit'))) { + throw new Meteor.Error('message-length-exceeds-character-limit'); + } + + } + const _id = this.bodyParams._id || Random.id(); const sendMessage = { From 7dc333090bddd71676815c1bdcbbca54d547f7f8 Mon Sep 17 00:00:00 2001 From: yash-rajpal Date: Mon, 25 Jan 2021 10:00:00 +0530 Subject: [PATCH 3/5] Revert "Changed broken link for english" This reverts commit 5c6e64cbe18cb8f58894a0c80f00afd14202e58b. --- packages/rocketchat-i18n/i18n/en.i18n.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 62278257899d..4bb88308608e 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -3252,7 +3252,7 @@ "RetentionPolicyRoom_FilesOnly": "Prune files only, keep messages", "RetentionPolicyRoom_MaxAge": "Maximum message age in days (default: __max__)", "RetentionPolicyRoom_OverrideGlobal": "Override global retention policy", - "RetentionPolicyRoom_ReadTheDocs": "Watch out! Tweaking these settings without utmost care can destroy all message history. Please read the documentation before turning the feature on here.", + "RetentionPolicyRoom_ReadTheDocs": "Watch out! Tweaking these settings without utmost care can destroy all message history. Please read the documentation before turning the feature on here.", "Retry_Count": "Retry Count", "Return_to_home": "Return to home", "Return_to_previous_page": "Return to previous page", From 7f92bb2664e6851293a9d3f70579fa6518ef0843 Mon Sep 17 00:00:00 2001 From: yash-rajpal Date: Mon, 25 Jan 2021 10:09:18 +0530 Subject: [PATCH 4/5] lint fixes --- app/livechat/server/api/v1/message.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/livechat/server/api/v1/message.js b/app/livechat/server/api/v1/message.js index 89e830d81f40..bc3bc2be4598 100644 --- a/app/livechat/server/api/v1/message.js +++ b/app/livechat/server/api/v1/message.js @@ -9,7 +9,7 @@ import { loadMessageHistory } from '../../../../lib'; import { findGuest, findRoom, normalizeHttpHeaderData } from '../lib/livechat'; import { Livechat } from '../../lib/Livechat'; import { normalizeMessageFileUpload } from '../../../../utils/server/functions/normalizeMessageFileUpload'; -import { settings } from '../../../../../app/settings/server'; +import { settings } from '../../../../settings/server'; API.v1.addRoute('livechat/message', { post() { @@ -41,11 +41,10 @@ API.v1.addRoute('livechat/message', { throw new Meteor.Error('room-closed'); } - if(settings.get('Livechat_enable_message_character_limit')) { - if(msg.length > parseInt(settings.get('Livechat_message_character_limit'))) { + if (settings.get('Livechat_enable_message_character_limit')) { + if (msg.length > parseInt(settings.get('Livechat_message_character_limit'))) { throw new Meteor.Error('message-length-exceeds-character-limit'); } - } const _id = this.bodyParams._id || Random.id(); From 10e2ea583cf2a33710b015181787a7d6c854f44d Mon Sep 17 00:00:00 2001 From: yash-rajpal Date: Mon, 15 Feb 2021 23:10:32 +0530 Subject: [PATCH 5/5] if condn changes --- app/livechat/server/api/v1/message.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/livechat/server/api/v1/message.js b/app/livechat/server/api/v1/message.js index bc3bc2be4598..df8ac26a07f7 100644 --- a/app/livechat/server/api/v1/message.js +++ b/app/livechat/server/api/v1/message.js @@ -41,10 +41,8 @@ API.v1.addRoute('livechat/message', { throw new Meteor.Error('room-closed'); } - if (settings.get('Livechat_enable_message_character_limit')) { - if (msg.length > parseInt(settings.get('Livechat_message_character_limit'))) { - throw new Meteor.Error('message-length-exceeds-character-limit'); - } + if (settings.get('Livechat_enable_message_character_limit') && msg.length > parseInt(settings.get('Livechat_message_character_limit'))) { + throw new Meteor.Error('message-length-exceeds-character-limit'); } const _id = this.bodyParams._id || Random.id();