only set currentuser attr if true

This commit is contained in:
Jiiks 2018-03-08 16:46:50 +02:00
parent fcebb43f35
commit 88b46bc359
1 changed files with 4 additions and 2 deletions

View File

@ -137,6 +137,7 @@ export default class {
this.setId(msg);
}
}
setId(msg) {
if (msg.hasAttribute('message-id')) return;
const r = Reflection(msg);
@ -145,10 +146,11 @@ export default class {
const { id, author } = message;
if (!id || !author) return;
const currentUser = author.id === TempApi.currentUserId;
DOM.setAttributes(msg, [{ name: 'message-id', value: message.id }]);
msg.setAttribute('message-id', message.id);
const msgGroup = msg.closest('.message-group');
if (!msgGroup) return;
DOM.setAttributes(msgGroup, [{ name: 'author-id', value: author.id }, { name: 'author-is-currentuser', value: currentUser }]);
msgGroup.setAttribute('author-id', author.id);
if (currentUser) msgGroup.setAttribute('author-is-currentuser', true);
}
get appMount() {