Fix #276: Peertube v6.0.0 compatibility in chatrooms page:

Using channel.avatars if channel.avatar is not available.
This commit is contained in:
John Livingston 2023-11-16 10:46:58 +01:00
parent 27b32f022b
commit 73922680c1
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
2 changed files with 13 additions and 1 deletions

View File

@ -5,7 +5,8 @@
### Minor changes and fixes
* Peertube v6.0.0 compatibility:
* avatars: using account.avatars if account.avatar is not available (Fix #275).
* xmpp avatars: using account.avatars if account.avatar is not available (Fix #275).
* chatrooms screen: using channel.avatars if channel.avatar is not available (Fix #276).
* Translation updates: German, Dutch, Japanese, Basque.
## 8.0.2

View File

@ -33,6 +33,17 @@ async function renderConfigurationHome (registerClientOptions: RegisterClientOpt
for (const channel of channels.data) {
channel.livechatConfigurationUri = '/p/livechat/configuration/channel?channelId=' + encodeURIComponent(channel.id)
// Note: since Peertube v6.0.0, channel.avatar is dropped, and we have to use channel.avatars.
// So, if !channel.avatar, we will search a suitable one in channel.avatars, and fill channel.avatar.
if (!channel.avatar && channel.avatars && Array.isArray(channel.avatars)) {
for (const avatar of channel.avatars) {
if (avatar.width === 120) {
channel.avatar = avatar
break
}
}
}
}
const view = {