From 865a123897dba669723da08999ade435f4aedee1 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sun, 7 Mar 2021 19:40:16 +0100 Subject: [PATCH] Avoid the presence of multiple phone buttons --- assets/js/components/conversations/chatWindows.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/js/components/conversations/chatWindows.js b/assets/js/components/conversations/chatWindows.js index 81b13951..2decbaab 100644 --- a/assets/js/components/conversations/chatWindows.js +++ b/assets/js/components/conversations/chatWindows.js @@ -799,6 +799,11 @@ const ConvChatWindow = { */ showCallButton: function(conversation){ + // Remove previous button (if any) + let previousButton = conversation.box.boxTools.querySelector(".phone-button"); + if(previousButton) + previousButton.remove(); + //Check if calls are disabled if(!conversation.infos.can_have_call) return; @@ -807,7 +812,7 @@ const ConvChatWindow = { const button = createElem2({ insertBefore: conversation.box.boxTools.firstChild, type: "button", - class: "btn btn-box-tool", + class: "btn btn-box-tool phone-button", innerHTML: "" }); conversation.box.callButton = button;