From b75c7716c9cadff77385b8edbfa250b05461706d Mon Sep 17 00:00:00 2001 From: Jiiks Date: Thu, 8 Mar 2018 19:37:50 +0200 Subject: [PATCH] User reflection prop iterator --- client/src/ui/automanip.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/client/src/ui/automanip.js b/client/src/ui/automanip.js index b14265bf..9665d7bd 100644 --- a/client/src/ui/automanip.js +++ b/client/src/ui/automanip.js @@ -153,17 +153,14 @@ export default class { setId(msg) { if (msg.hasAttribute('message-id')) return; - const r = Reflection(msg); - const message = r.prop('message'); - if (!message) return; - const { id, author } = message; - if (!id || !author) return; - const currentUser = author.id === TempApi.currentUserId; - msg.setAttribute('message-id', message.id); + const messageid = Reflection(msg).prop('message'); + const authorid = Reflection(msg).prop('message.author.id'); + if (!messageid || !authorid) return; + msg.setAttribute('message-id', messageid); const msgGroup = msg.closest('.message-group'); if (!msgGroup) return; - msgGroup.setAttribute('author-id', author.id); - if (currentUser) msgGroup.setAttribute('author-is-currentuser', true); + msgGroup.setAttribute('author-id', authorid); + if (authorid === TempApi.currentUserId) msgGroup.setAttribute('author-is-currentuser', true); } setUserId(user) {