mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 05:49:22 +00:00
"Forward" user information to emoji parser
This commit is contained in:
parent
527f0a838c
commit
8d6adb336c
@ -231,7 +231,8 @@ const CommentsUI = {
|
||||
|
||||
//Parse emojies
|
||||
ComunicWeb.components.textParser.parse({
|
||||
element: commentContent
|
||||
element: commentContent,
|
||||
user: user
|
||||
});
|
||||
|
||||
//Add comment image (if any)
|
||||
|
@ -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,
|
||||
});
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -262,7 +262,8 @@ ComunicWeb.pages.userPage.profileInfos = {
|
||||
|
||||
//Parse text
|
||||
ComunicWeb.components.textParser.parse({
|
||||
element: publicNotes
|
||||
element: publicNotes,
|
||||
user: infos
|
||||
});
|
||||
|
||||
//Add separator
|
||||
|
Loading…
Reference in New Issue
Block a user