|
|
@ -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) {
|
|
|
|