fix: view.vue-config (cannot send empty messages; empty means if trimmed message has a length of 0)

This commit is contained in:
xdrm-brackets 2017-12-05 20:57:39 +01:00
parent 49b4e0a914
commit 7b5c057da6
1 changed files with 7 additions and 2 deletions

View File

@ -74,10 +74,15 @@ gstore.add('func', {
}, },
toggleMenuSize: function(){ gstore.data.min_menu=!gstore.data.min_menu; }, toggleMenuSize: function(){ gstore.data.min_menu=!gstore.data.min_menu; },
sendMessage: function(msg){ sendMessage: function(msg){
/* (1) Send message to WebSocket */ /* (1) If empty message -> abort */
if( msg.trim().length == 0 )
return;
/* (2) Send message to WebSocket */
wsc_chat.send(JSON.stringify({message: msg})); wsc_chat.send(JSON.stringify({message: msg}));
/* (2) Add locally */ /* (3) Add locally */
gstore.data.notif[1].data.push([ gstore.data.server.session.name, msg ]); gstore.data.notif[1].data.push([ gstore.data.server.session.name, msg ]);
} }
}); });