Skip to content
Snippets Groups Projects
Commit 292adc48 authored by Philip Nuzhnyy's avatar Philip Nuzhnyy
Browse files

prevent message sending if it exceeds max message limit setting

-----------------
[Geogit] // sent from France, Courbevoie [48.8967,2.2567] :FR:
parent 29395511
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ class @ChatMessages
init: (node) ->
this.editing = {}
this.messageMaxSize = RocketChat.settings.get('Message_MaxAllowedSize')
this.wrapper = $(node).find(".wrapper")
this.input = $(node).find(".input-message").get(0)
this.bindEvents()
......@@ -65,7 +66,8 @@ class @ChatMessages
this.editing.saved = this.input.value
send: (rid, input) ->
if _.trim(input.value) isnt ''
if _.trim(input.value) isnt '' and not this.isMessageTooLong(input)
console.error 'sending', input.value
KonchatNotification.removeRoomNotification(rid)
msg = input.value
input.value = ''
......@@ -185,3 +187,6 @@ class @ChatMessages
# ctrl (command) + shift + k -> clear room messages
else if k is 75 and ((navigator?.platform?.indexOf('Mac') isnt -1 and event.metaKey and event.shiftKey) or (navigator?.platform?.indexOf('Mac') is -1 and event.ctrlKey and event.shiftKey))
RoomHistoryManager.clear rid
isMessageTooLong: (input) ->
input?.value.length > this.messageMaxSize
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment