Merge pull request #6660 from Ocelot-Social-Community/try-to-fix-avatars

fix(webapp): try to fix avatars
This commit is contained in:
Hannes Heine 2023-08-09 11:24:31 +02:00 committed by GitHub
commit f933bd20ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -334,6 +334,9 @@ export default {
;[...this.messages, ...Message].forEach((m) => {
if (m.senderId !== this.currentUser.id) m.seen = true
m.date = new Date(m.date).toDateString()
if (!m.avatar.startsWith('/api/')) {
m.avatar = this.$filters.proxyApiUrl(m.avatar)
}
msgs[m.indexId] = m
})
this.messages = msgs.filter(Boolean)
@ -406,6 +409,7 @@ export default {
const fixedRoom = {
...room,
index: room.lastMessage ? room.lastMessage.date : room.createdAt,
avatar: this.$filters.proxyApiUrl(room.avatar),
lastMessage: room.lastMessage
? {
...room.lastMessage,
@ -413,7 +417,7 @@ export default {
}
: null,
users: room.users.map((u) => {
return { ...u, username: u.name, avatar: u.avatar?.url }
return { ...u, username: u.name, avatar: this.$filters.proxyApiUrl(u.avatar?.url) }
}),
}
if (!fixedRoom.avatar) {