Update CommunicationsChat.vue

This commit is contained in:
Troplo 2022-07-30 15:29:04 +10:00
parent 89cee44fda
commit d80c7a76e6

View file

@ -812,6 +812,33 @@ export default {
} }
}, },
methods: { 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) { async scrollEvent(e) {
this.avoidAutoScroll = this.avoidAutoScroll =
e.target.scrollTop + e.target.offsetHeight !== e.target.scrollHeight e.target.scrollTop + e.target.offsetHeight !== e.target.scrollHeight