fix parent updates

isekai-main
Barış Soner Uşaklı 2 years ago
parent 9ba6dda8bf
commit ec0747fd0d

@ -101,10 +101,10 @@
"nodebb-plugin-ntfy": "1.2.5", "nodebb-plugin-ntfy": "1.2.5",
"nodebb-plugin-spam-be-gone": "2.1.1", "nodebb-plugin-spam-be-gone": "2.1.1",
"nodebb-rewards-essentials": "0.2.3", "nodebb-rewards-essentials": "0.2.3",
"nodebb-theme-harmony": "1.1.28", "nodebb-theme-harmony": "1.1.29",
"nodebb-theme-lavender": "7.1.3", "nodebb-theme-lavender": "7.1.3",
"nodebb-theme-peace": "2.1.9", "nodebb-theme-peace": "2.1.10",
"nodebb-theme-persona": "13.2.14", "nodebb-theme-persona": "13.2.15",
"nodebb-widget-essentials": "7.0.13", "nodebb-widget-essentials": "7.0.13",
"nodemailer": "6.9.4", "nodemailer": "6.9.4",
"nprogress": "0.2.0", "nprogress": "0.2.0",

@ -263,16 +263,19 @@ define('forum/chats/messages', [
const self = parseInt(message.fromuid, 10) === parseInt(app.user.uid, 10); const self = parseInt(message.fromuid, 10) === parseInt(app.user.uid, 10);
message.self = self ? 1 : 0; message.self = self ? 1 : 0;
messages.parseMessage(message, function (html) { messages.parseMessage(message, function (html) {
const msgEl = components.get('chat/message', message.mid);
if (msgEl.length) {
msgEl.replaceWith(html);
messages.onMessagesAddedToDom(components.get('chat/message', message.mid));
}
const parentEl = $(`[component="chat/message/parent"][data-parent-mid="${message.mid}"]`); const parentEl = $(`[component="chat/message/parent"][data-parent-mid="${message.mid}"]`);
if (parentEl.length) { if (parentEl.length) {
parentEl.find('[component="chat/message/parent/content"]').html( parentEl.find('[component="chat/message/parent/content"]').html(
html.find('[component="chat/message/body"]').html() html.find('[component="chat/message/body"]').html()
); );
} messages.onMessagesAddedToDom(
const msgEl = components.get('chat/message', message.mid); $(`[component="chat/message/parent"][data-parent-mid="${message.mid}"]`)
if (msgEl.length) { );
msgEl.replaceWith(html);
messages.onMessagesAddedToDom(components.get('chat/message', message.mid));
} }
}); });
}); });
@ -302,15 +305,17 @@ define('forum/chats/messages', [
const isParentSelf = parseInt(parentEl.attr('data-uid'), 10) === app.user.uid; const isParentSelf = parseInt(parentEl.attr('data-uid'), 10) === app.user.uid;
msgEl.toggleClass('deleted', false); msgEl.toggleClass('deleted', false);
parentEl.toggleClass('deleted', false); parentEl.toggleClass('deleted', false);
if (!isParentSelf) {
parentEl.find('[component="chat/message/parent/content"]')
.translateHtml(message.content);
}
if (!isSelf) { if (!isSelf) {
msgEl.find('[component="chat/message/body"]') msgEl.find('[component="chat/message/body"]')
.translateHtml(message.content); .translateHtml(message.content);
messages.onMessagesAddedToDom(components.get('chat/message', message.messageId)); messages.onMessagesAddedToDom(components.get('chat/message', message.messageId));
} }
if (!isParentSelf && parentEl.length) {
parentEl.find('[component="chat/message/parent/content"]')
.translateHtml(message.content);
messages.onMessagesAddedToDom($(`[component="chat/message/parent"][data-parent-mid="${message.messageId}"]`));
}
} }
messages.delete = function (messageId, roomId) { messages.delete = function (messageId, roomId) {

Loading…
Cancel
Save