From d655c397e0ba1ce022341d3501a28c62c83e19ea Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Fri, 22 Jan 2021 11:09:34 +1100 Subject: [PATCH] make the isAdmin coming from the convo props and not the messages --- js/models/messages.js | 3 --- stylesheets/_avatar.scss | 6 +++--- stylesheets/_modules.scss | 6 ------ stylesheets/_session.scss | 3 ++- test/index.html | 2 +- ts/components/session/conversation/SessionMessagesList.tsx | 3 +++ 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/js/models/messages.js b/js/models/messages.js index d37eae81c..c209a0df1 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -517,8 +517,6 @@ // for the public group chat const conversation = this.getConversation(); - const isAdmin = conversation && !!conversation.isAdmin(phoneNumber); - const convoId = conversation ? conversation.id : undefined; const isGroup = !!conversation && !conversation.isPrivate(); const isPublic = !!this.get('isPublic'); @@ -552,7 +550,6 @@ isPublic, isKickedFromGroup: conversation && conversation.get('isKickedFromGroup'), - isAdmin, // if the sender is an admin (not us) onCopyText: () => this.copyText(), onCopyPubKey: () => this.copyPubKey(), diff --git a/stylesheets/_avatar.scss b/stylesheets/_avatar.scss index 5cad1f342..f9b48aa91 100644 --- a/stylesheets/_avatar.scss +++ b/stylesheets/_avatar.scss @@ -29,9 +29,9 @@ } .module-avatar__icon--crown-wrapper { - position: relative; - bottom: -38px; - right: -16px; + position: absolute; + bottom: 0%; + right: 12%; height: 21px; width: 21px; transform: translate(25%, 25%); diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 99f2dc60e..e8f92107f 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -396,12 +396,6 @@ } } -.module-message__author-avatar { - flex-direction: column-reverse; - display: inline-flex; - padding-inline-end: 4px; -} - .module-message__typing-container { height: 16px; padding-bottom: 20px; diff --git a/stylesheets/_session.scss b/stylesheets/_session.scss index 549e94bf7..ba6ea5d30 100644 --- a/stylesheets/_session.scss +++ b/stylesheets/_session.scss @@ -328,9 +328,10 @@ textarea { } .module-message__author-avatar { - display: inline-flex; + position: relative; margin-inline-end: 20px; padding-top: 5px; + padding-inline-end: 4px; margin-bottom: auto; } diff --git a/test/index.html b/test/index.html index 50b49aea1..e12b76c58 100644 --- a/test/index.html +++ b/test/index.html @@ -201,7 +201,7 @@ - + diff --git a/ts/components/session/conversation/SessionMessagesList.tsx b/ts/components/session/conversation/SessionMessagesList.tsx index c480ab6e1..7d7d454cc 100644 --- a/ts/components/session/conversation/SessionMessagesList.tsx +++ b/ts/components/session/conversation/SessionMessagesList.tsx @@ -289,6 +289,9 @@ export class SessionMessagesList extends React.Component { (conversation.isPublic && !!messageProps.weAreAdmin); messageProps.isDeletable = isDeletable; + messageProps.isAdmin = conversation.groupAdmins?.includes( + messageProps.authorPhoneNumber + ); // firstMessageOfSeries tells us to render the avatar only for the first message // in a series of messages from the same user