From d80c7a76e649d65a645d7702aa9fbb0a7b206809 Mon Sep 17 00:00:00 2001 From: Troplo Date: Sat, 30 Jul 2022 15:29:04 +1000 Subject: [PATCH] Update CommunicationsChat.vue --- .../Communications/CommunicationsChat.vue | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/frontend/src/views/Communications/CommunicationsChat.vue b/frontend/src/views/Communications/CommunicationsChat.vue index 819a342..47aad3b 100644 --- a/frontend/src/views/Communications/CommunicationsChat.vue +++ b/frontend/src/views/Communications/CommunicationsChat.vue @@ -812,6 +812,33 @@ export default { } }, methods: { + getDirectRecipient(item) { + let user = item.chat.users.find( + (user) => user.id !== this.$store.state.user.id + ) + if (user) { + if (user.nickname?.nickname) { + user.name = user.nickname.nickname + } else { + user.name = user.username + } + return { + ...user, + type: item.chat.type + } + } else { + let user = item.chat.users[0] + if (user.nickname?.nickname) { + user.name = user.nickname.nickname + } else { + user.name = user.username + } + return { + ...user, + type: item.chat.type + } + } + }, async scrollEvent(e) { this.avoidAutoScroll = e.target.scrollTop + e.target.offsetHeight !== e.target.scrollHeight