mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-24 18:08:50 +00:00
Check new conversation messages
This commit is contained in:
parent
207ca44ac7
commit
7383be8fe9
@ -255,4 +255,21 @@ function createFormGroup(infos){
|
|||||||
|
|
||||||
//Return input
|
//Return input
|
||||||
return input;
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a string is valid and ready to be sent to be saved
|
||||||
|
*
|
||||||
|
* @param {String} value The input string to send
|
||||||
|
* @return {Boolean} True if the string is valid, false else
|
||||||
|
*/
|
||||||
|
function checkString(value){
|
||||||
|
|
||||||
|
//First, check string length
|
||||||
|
if(value.length < 5)
|
||||||
|
return false; //Lenght invalid
|
||||||
|
|
||||||
|
//Success, the string seems to be valid
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
@ -561,13 +561,14 @@ ComunicWeb.components.conversations.chatWindows = {
|
|||||||
* @return {Boolean} True for a success
|
* @return {Boolean} True for a success
|
||||||
*/
|
*/
|
||||||
submitMessageForm: function(convInfos){
|
submitMessageForm: function(convInfos){
|
||||||
|
|
||||||
//Log action
|
//Log action
|
||||||
ComunicWeb.debug.logMessage("Send a new message in a conversation system.");
|
ComunicWeb.debug.logMessage("Send a new message in a conversation system.");
|
||||||
console.log(convInfos);
|
console.log(convInfos);
|
||||||
|
|
||||||
//Check if message is empty
|
//Check if message is empty
|
||||||
//if(convInfos.sendMessageForm.inputText)
|
if(!checkString(convInfos.box.sendMessageForm.inputText.value))
|
||||||
|
ComunicWeb.common.notificationSystem.showNotification("Please type a valid message before trying to send it !", "danger", 2);
|
||||||
|
|
||||||
//Success
|
//Success
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user