diff --git a/assets/custom_ts/Utils.d.ts b/assets/custom_ts/Utils.d.ts index 75a862e2..b66f574f 100644 --- a/assets/custom_ts/Utils.d.ts +++ b/assets/custom_ts/Utils.d.ts @@ -24,7 +24,8 @@ declare interface CreateElem2Args { innerHTMLprefix ?: string, disabled ?: boolean, children ?: HTMLElement[], - onclick ?: Function + onclick ?: Function, + ondblclick ?: Function } declare function createElem(nodeType : string, appendTo : string) : HTMLElement; diff --git a/assets/js/common/shorcuts.js b/assets/js/common/shorcuts.js index fb40b446..b5df072d 100644 --- a/assets/js/common/shorcuts.js +++ b/assets/js/common/shorcuts.js @@ -145,11 +145,16 @@ function log(message){ * Open a conversation specified by its ID * * @param {number} id The ID of the conversation to open + * @param {bool} fullscreen Specify whether the conversation has to + * appear in full screen or not */ -function openConversation(id){ - ComunicWeb.components.conversations.manager.addConversation({ - conversationID: id - }); +function openConversation(id, fullscreen = false){ + if(!fullscreen) + ComunicWeb.components.conversations.manager.addConversation({ + conversationID: id + }); + else + openPage("conversations/" + id); } /** diff --git a/assets/js/common/utils.js b/assets/js/common/utils.js index 13134332..5378b7be 100644 --- a/assets/js/common/utils.js +++ b/assets/js/common/utils.js @@ -45,6 +45,7 @@ function createElem(nodeType, appendTo){ * @info {boolean} disabled Set whether the field should be disabled or not (input only) * @info {HTMLElement[]} children Children for the new object * @info {Function} onclick + * @info {Function} ondblclick * @return {HTMLElement} The newly created element */ function createElem2(infos){ @@ -132,6 +133,9 @@ function createElem2(infos){ if(infos.onclick) newElem.addEventListener("click", infos.onclick); + + if(infos.ondblclick) + newElem.addEventListener("dblclick", infos.ondblclick); //Return newly created element return newElem; diff --git a/assets/js/components/conversations/chatWindows.js b/assets/js/components/conversations/chatWindows.js index 21dde14b..37b0e6d4 100644 --- a/assets/js/components/conversations/chatWindows.js +++ b/assets/js/components/conversations/chatWindows.js @@ -386,24 +386,32 @@ ComunicWeb.components.conversations.chatWindows = { * Change the name of the converation at the top of the windows * * @param {String} newName The new name for the conversation window - * @param {Ojbect} infos Informations about the conversation window + * @param {Ojbect} info Information about the conversation window * @return {Boolean} True for a success */ - changeName: function(newName, infos){ + changeName: function(newName, info){ //Reduce new name if(newName.length > 18) newName = newName.slice(0, 17) + "..."; //Empty name field - emptyElem(infos.boxTitle); + emptyElem(info.boxTitle); //Create conversation icon - var conversationIcon = createElem("i", infos.boxTitle); - conversationIcon.className = "fa fa-comments"; + createElem2({ + type: "i", + appendTo: info.boxTitle, + class: "fa fa-comments", + ondblclick: () => { + openConversation(info.conversationID, true); + info.closeFunction(); + } + }); + //Add conversation title - var conversationTitle = createElem("span", infos.boxTitle); + var conversationTitle = createElem("span", info.boxTitle); conversationTitle.innerHTML = " " + newName; //Success diff --git a/assets/js/components/conversations/service.js b/assets/js/components/conversations/service.js index eb6a3f7f..752a2eb4 100644 --- a/assets/js/components/conversations/service.js +++ b/assets/js/components/conversations/service.js @@ -153,7 +153,7 @@ ComunicWeb.components.conversations.service = { for(i in result){ //Check if new entries are available - if(result[i].length === 0) + if(result[i].length === 0 || !this.__serviceCache[i]) continue; //Nothing to be done //Extract conversation ID diff --git a/assets/js/pages/conversations/conversation.js b/assets/js/pages/conversations/conversation.js index c0a1b9ae..f286dbfc 100644 --- a/assets/js/pages/conversations/conversation.js +++ b/assets/js/pages/conversations/conversation.js @@ -63,6 +63,15 @@ ComunicWeb.pages.conversations.conversation = { class: "box-header" }); + // Box icon + createElem2({ + appendTo: boxHeader, + type: "span", + class: "box-title", + innerHTML: " ", + ondblclick: () => openConversation(convID, false) + }); + //Box title var boxTitle = createElem2({ appendTo: boxHeader,