diff --git a/assets/js/components/comments/ui.js b/assets/js/components/comments/ui.js index b5c4edea..74d83152 100644 --- a/assets/js/components/comments/ui.js +++ b/assets/js/components/comments/ui.js @@ -231,7 +231,8 @@ const CommentsUI = { //Parse emojies ComunicWeb.components.textParser.parse({ - element: commentContent + element: commentContent, + user: user }); //Add comment image (if any) diff --git a/assets/js/components/conversations/chatWindows.js b/assets/js/components/conversations/chatWindows.js index 9086452c..8a3e7822 100644 --- a/assets/js/components/conversations/chatWindows.js +++ b/assets/js/components/conversations/chatWindows.js @@ -891,10 +891,11 @@ const ConvChatWindow = { }); //Load user informations + let userInfos; if(conversationInfo.membersInfos["user-" + message.ID_user]){ //Get informations - var userInfos = conversationInfo.membersInfos["user-" + message.ID_user]; + userInfos = conversationInfo.membersInfos["user-" + message.ID_user]; //Replace poster name usernameElem.innerHTML = userInfos.firstName + " " + userInfos.lastName; @@ -953,6 +954,7 @@ const ConvChatWindow = { //Parse emojies in text message ComunicWeb.components.textParser.parse({ element: textMessage, + user: userInfos, }); diff --git a/assets/js/components/emoji/parser.js b/assets/js/components/emoji/parser.js index cd1e2a93..c21de3b3 100644 --- a/assets/js/components/emoji/parser.js +++ b/assets/js/components/emoji/parser.js @@ -26,16 +26,22 @@ ComunicWeb.components.emoji.parser = { * @info {HTMLElement} element The element to parse * @return {Boolean} True for a success */ - parse: function(infos){ + parse: function(info){ //Peform string parsing - infos.element.innerHTML = this.shorcutToHTMLcode(infos.element.innerHTML); + info.element.innerHTML = this.shorcutToHTMLcode(info.element.innerHTML); + + // Parse custom semicolons + if(info.user) + console.log(info.user);//info.element.innerHTML = this.parseCustomEmojis(infos.elements.innerHTML) + else + console.error("User information are missing!") //Perform colon conversion - infos.element.innerHTML = this.colonConversion(infos.element.innerHTML); + info.element.innerHTML = this.colonConversion(info.element.innerHTML); //Perform Twitter parsing - this.twitterEmojiesParsing(infos.element); + this.twitterEmojiesParsing(info.element); //Success return true; diff --git a/assets/js/components/posts/ui.js b/assets/js/components/posts/ui.js index 56776bcb..bd9703c3 100644 --- a/assets/js/components/posts/ui.js +++ b/assets/js/components/posts/ui.js @@ -12,7 +12,7 @@ ComunicWeb.components.posts.ui = { * @param {Object} infos Informations about the post * @param {HTMLElement} target The target for the post */ - display_post: function(info, target) { + display_post: async function(info, target) { //Check if it is required to create a post root element or not if(target.className.includes("post")) @@ -867,7 +867,8 @@ ComunicWeb.components.posts.ui = { //Parse emojies ComunicWeb.components.textParser.parse({ - element: postContent + element: postContent, + user: await userInfo(info.userID) }); //Add bottom elements container diff --git a/assets/js/components/textParser.js b/assets/js/components/textParser.js index fff7b482..86c65ea5 100644 --- a/assets/js/components/textParser.js +++ b/assets/js/components/textParser.js @@ -25,7 +25,8 @@ ComunicWeb.components.textParser = { //Parse emojies ComunicWeb.components.emoji.parser.parse({ - element: info.element + element: info.element, + user: info.user }); //Parse users tags diff --git a/assets/js/pages/conversations/conversation.js b/assets/js/pages/conversations/conversation.js index 30483a65..1ffbcb49 100644 --- a/assets/js/pages/conversations/conversation.js +++ b/assets/js/pages/conversations/conversation.js @@ -291,7 +291,8 @@ const ConversationPageConvPart = { //Parse message content ComunicWeb.components.textParser.parse({ - element: messageContent + element: messageContent, + user: this._conv_info.users["user-" + info.ID_user] }); //Message image (if any) @@ -600,7 +601,7 @@ document.addEventListener("newConvMessage", (e) => { }) // Register to message update events -document.addEventListener("updatedConvMessage", (e) => { +document.addEventListener("updatedConvMessage", async (e) => { const msg = e.detail; const target = document.querySelector("[data-chatpage-msg-text-id='"+msg.ID+"'] .txt") @@ -617,7 +618,8 @@ document.addEventListener("updatedConvMessage", (e) => { //Parse message content ComunicWeb.components.textParser.parse({ - element: newMessageContent + element: newMessageContent, + user: await userInfo(info.ID_user) }); target.replaceWith(newMessageContent) diff --git a/assets/js/pages/userPage/profileInfos.js b/assets/js/pages/userPage/profileInfos.js index b34de17f..fddb2917 100644 --- a/assets/js/pages/userPage/profileInfos.js +++ b/assets/js/pages/userPage/profileInfos.js @@ -262,7 +262,8 @@ ComunicWeb.pages.userPage.profileInfos = { //Parse text ComunicWeb.components.textParser.parse({ - element: publicNotes + element: publicNotes, + user: infos }); //Add separator