MDL-57270 core_message: trim message before it is sent
authorMark Nelson <markn@moodle.com>
Wed, 14 Dec 2016 04:13:53 +0000 (12:13 +0800)
committerMark Nelson <markn@moodle.com>
Wed, 14 Dec 2016 04:18:58 +0000 (12:18 +0800)
message/amd/build/message_area_messages.min.js
message/amd/src/message_area_messages.js

index 0451bee..c62ff2c 100644 (file)
Binary files a/message/amd/build/message_area_messages.min.js and b/message/amd/build/message_area_messages.min.js differ
index 9410475..3188100 100644 (file)
@@ -393,10 +393,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/cust
          */
         Messages.prototype._sendMessage = function() {
             var element = this.messageArea.find(SELECTORS.SENDMESSAGETEXT);
-            var text = element.val();
+            var text = element.val().trim();
 
             // Do not do anything if it is empty.
-            if (text.trim() === '') {
+            if (text === '') {
                 return false;
             }