From 417b8a6600903c30c76f166f552c3194420cdf44 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 6 Mar 2021 14:52:35 +0100 Subject: [PATCH] Can request message content update --- .../components/conversations/chatWindows.js | 39 ++++++++++--------- .../components/conversations/messageEditor.js | 2 +- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/assets/js/components/conversations/chatWindows.js b/assets/js/components/conversations/chatWindows.js index b323901a..30e50a64 100644 --- a/assets/js/components/conversations/chatWindows.js +++ b/assets/js/components/conversations/chatWindows.js @@ -968,25 +968,28 @@ const ConvChatWindow = { //Add message options if(userIsPoster){ - //Update message content - var updateLi = createElem2({ - type: "li", - appendTo: dropdownMenu - }); - - var updateLink = createElem2({ - type: "a", - appendTo: updateLi, - innerHTML: "Edit" - }); - - updateLink.addEventListener("click", function(){ - ComunicWeb.components.conversations.messageEditor.open(message, function(newContent){ - /* - DEPRECATED WITH WEBSOCKETS - */ + if (message.file == null) + { + //Update message content + var updateLi = createElem2({ + type: "li", + appendTo: dropdownMenu }); - }); + + var updateLink = createElem2({ + type: "a", + appendTo: updateLi, + innerHTML: "Edit" + }); + + updateLink.addEventListener("click", function(){ + ComunicWeb.components.conversations.messageEditor.open(message, function(newContent){ + /* + DEPRECATED WITH WEBSOCKETS + */ + }); + }); + } diff --git a/assets/js/components/conversations/messageEditor.js b/assets/js/components/conversations/messageEditor.js index 3b729c0e..5a21d859 100644 --- a/assets/js/components/conversations/messageEditor.js +++ b/assets/js/components/conversations/messageEditor.js @@ -27,7 +27,7 @@ ComunicWeb.components.conversations.messageEditor = { //Intend to update message content ComunicWeb.components.conversations.interface.UpdateSingleMessage( - message.ID, + message.id, content, function(result){