ComunicWeb/assets/js/components/conversations/messageEditor.js

49 lines
979 B
JavaScript
Raw Permalink Normal View History

/**
* Conversation message editor
*
* @author Pierre HUBERT
*/
ComunicWeb.components.conversations.messageEditor = {
/**
* Open conversation message editor
*
* @param {Object} message Information about the message to open
* @param {(newcontent : String) => any} callback Callback function called only
* when the new message content has been applied
*/
open: function(message, callback){
ComunicWeb.common.messages.inputString(
"Update message content",
"Please specify the new content of the message:",
message.message,
function(content){
2019-01-20 18:40:29 +00:00
if(!content)
return;
//Intend to update message content
ComunicWeb.components.conversations.interface.UpdateSingleMessage(
2021-03-06 13:52:35 +00:00
message.id,
content,
function(result){
if(!result)
return notify("Could not update conversation message content!", "danger");
message.message = content;
callback(content);
}
);
}
);
}
}