diff --git a/assets/js/common/shorcuts.js b/assets/js/common/shorcuts.js index 658c6039..ecc6015e 100644 --- a/assets/js/common/shorcuts.js +++ b/assets/js/common/shorcuts.js @@ -100,4 +100,15 @@ function getMultipleUsersInfos(usersID, afterGetUserInfos, forceRequest){ */ function log(message){ ComunicWeb.debug.logMessage(message); +} + +/** + * Open a conversation specified by its ID + * + * @param {number} id The ID of the conversation to open + */ +function openConversation(id){ + ComunicWeb.components.conversations.manager.addConversation({ + conversationID: id + }); } \ No newline at end of file diff --git a/assets/js/components/conversations/unreadDropdown.js b/assets/js/components/conversations/unreadDropdown.js index 8f0a66c2..bcfe0147 100644 --- a/assets/js/components/conversations/unreadDropdown.js +++ b/assets/js/components/conversations/unreadDropdown.js @@ -173,6 +173,7 @@ ComunicWeb.components.conversations.unreadDropdown = { type: "a", href: "#" }); + convLink.setAttribute("data-conversation-id", conversation.id); //Add left elements var leftElems = createElem2({ @@ -220,13 +221,17 @@ ComunicWeb.components.conversations.unreadDropdown = { } - //Add the message var conversationMessage = createElem2({ appendTo: convLink, type: "p", innerHTML: ""+conversation.message+"" - }) + }); + + //Make the conversation link lives + convLink.onclick = function(){ + openConversation(this.getAttribute("data-conversation-id")); + } } },