diff options
author | Joas Schilling <coding@schilljs.com> | 2021-03-02 09:39:02 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-06-01 14:31:12 +0000 |
commit | 3949d98b0b3016bdd98b36aa9288b1eb9c85bcd1 (patch) | |
tree | aad0c0c3f2d92f47006303ac2f16420dc2c18b26 | |
parent | d1a34389cc50f6e278e6e5d2e04055d92aabe84a (diff) |
Inject the preloaded user status into the avatar component
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | src/components/AvatarWrapper/AvatarWrapper.vue | 5 | ||||
-rw-r--r-- | src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue | 20 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/components/AvatarWrapper/AvatarWrapper.vue b/src/components/AvatarWrapper/AvatarWrapper.vue index f6dad0537..89d0c9f98 100644 --- a/src/components/AvatarWrapper/AvatarWrapper.vue +++ b/src/components/AvatarWrapper/AvatarWrapper.vue @@ -34,6 +34,7 @@ :disable-menu="disableMenu" :show-user-status="showUserStatus" :show-user-status-compact="showUserStatusCompact" + :preloaded-user-status="preloadedUserStatus" :size="size" /> <div v-else class="guest" @@ -92,6 +93,10 @@ export default { type: Boolean, default: true, }, + preloadedUserStatus: { + type: Object, + default: undefined, + }, }, computed: { // Determines which icon is displayed diff --git a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue index e8ff85bb0..645559a72 100644 --- a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue +++ b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue @@ -40,6 +40,7 @@ :size="44" :show-user-status="showUserStatus && !isSearched" :show-user-status-compact="false" + :preloaded-user-status="preloadedUserStatus" :name="computedName" :source="participant.source || participant.actorType" :offline="isOffline" /> @@ -400,6 +401,25 @@ export default { canBePromoted() { return this.canModerate && !this.isModerator }, + preloadedUserStatus() { + if (this.participant.hasOwnProperty('statusMessage')) { + // We preloaded the status when via participants API + return { + status: this.participant.status || null, + message: this.participant.statusMessage || null, + icon: this.participant.statusIcon || null, + } + } + if (this.participant.hasOwnProperty('status')) { + // We preloaded the status when via search API + return { + status: this.participant.status.status || null, + message: this.participant.status.message || null, + icon: this.participant.status.icon || null, + } + } + return undefined + }, }, methods: { |