MDL-54687 core_message: do not send message if it is empty

This commit is contained in:
Mark Nelson
2016-10-07 16:26:40 +08:00
parent 2be15a66c4
commit 2c1b3775f0
+6
View File
@@ -211,6 +211,12 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/cust
*/
Messages.prototype._sendMessage = function() {
var text = this.messageArea.find(this.messageArea.SELECTORS.SENDMESSAGETEXT).val();
// Do not do anything if it is empty.
if (text.trim() === '') {
return;
}
// Call the web service to save our message.
var promises = ajax.call([{
methodname: 'core_message_send_instant_messages',