Skip to content

Commit

Permalink
message character limit for sendMessageLivechat
Browse files Browse the repository at this point in the history
  • Loading branch information
cuonghuunguyen authored and chnguyen committed Oct 27, 2021
1 parent 0d04049 commit bb1ec4f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/livechat/server/methods/sendMessageLivechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Match, check } from 'meteor/check';
import { LivechatVisitors } from '../../../models';
import { Livechat } from '../lib/Livechat';
import { OmnichannelSourceType } from '../../../../definition/IRoom';
import { settings } from '../../../settings/server';

Meteor.methods({
sendMessageLivechat({ token, _id, rid, msg, file, attachments }, agent) {
Expand All @@ -30,6 +31,10 @@ Meteor.methods({
throw new Meteor.Error('invalid-token');
}

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');
}

return Livechat.sendMessage({
guest,
message: {
Expand Down

0 comments on commit bb1ec4f

Please sign in to comment.