Avoid the presence of multiple phone buttons

This commit is contained in:
Pierre HUBERT 2021-03-07 19:40:16 +01:00
parent ca7768c8a7
commit 865a123897

View File

@ -799,6 +799,11 @@ const ConvChatWindow = {
*/ */
showCallButton: function(conversation){ 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 //Check if calls are disabled
if(!conversation.infos.can_have_call) if(!conversation.infos.can_have_call)
return; return;
@ -807,7 +812,7 @@ const ConvChatWindow = {
const button = createElem2({ const button = createElem2({
insertBefore: conversation.box.boxTools.firstChild, insertBefore: conversation.box.boxTools.firstChild,
type: "button", type: "button",
class: "btn btn-box-tool", class: "btn btn-box-tool phone-button",
innerHTML: "<i class='fa fa-phone'></i>" innerHTML: "<i class='fa fa-phone'></i>"
}); });
conversation.box.callButton = button; conversation.box.callButton = button;