aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-01 08:32:49 +0100
committerChocobozzz <me@florianbigard.com>2022-03-01 08:32:49 +0100
commit242f52253e46ce0ffd7349cb06bcd887bb89cf06 (patch)
tree91ff643ea722881a5e11e4446a3c696ec0f6e3cb /server/models
parentf41efa52a412272928ba90e06c9a9a9c471d1ca3 (diff)
downloadPeerTube-242f52253e46ce0ffd7349cb06bcd887bb89cf06.tar.gz
PeerTube-242f52253e46ce0ffd7349cb06bcd887bb89cf06.tar.zst
PeerTube-242f52253e46ce0ffd7349cb06bcd887bb89cf06.zip
Fix getting avatars in videos list
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/sql/video/shared/video-model-builder.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/models/video/sql/video/shared/video-model-builder.ts b/server/models/video/sql/video/shared/video-model-builder.ts
index b1b47b721..166ff9d31 100644
--- a/server/models/video/sql/video/shared/video-model-builder.ts
+++ b/server/models/video/sql/video/shared/video-model-builder.ts
@@ -234,15 +234,17 @@ export class VideoModelBuilder {
234 } 234 }
235 235
236 private addActorAvatar (row: SQLRow, actorPrefix: string, actor: ActorModel) { 236 private addActorAvatar (row: SQLRow, actorPrefix: string, actor: ActorModel) {
237 const avatarPrefix = `${actorPrefix}.Avatar` 237 const avatarPrefix = `${actorPrefix}.Avatars`
238 const id = row[`${avatarPrefix}.id`] 238 const id = row[`${avatarPrefix}.id`]
239 if (!id || this.actorImagesDone.has(id)) return 239 const key = `${row.id}${id}`
240
241 if (!id || this.actorImagesDone.has(key)) return
240 242
241 const attributes = this.grab(row, this.tables.getAvatarAttributes(), avatarPrefix) 243 const attributes = this.grab(row, this.tables.getAvatarAttributes(), avatarPrefix)
242 const avatarModel = new ActorImageModel(attributes, this.buildOpts) 244 const avatarModel = new ActorImageModel(attributes, this.buildOpts)
243 actor.Avatars.push(avatarModel) 245 actor.Avatars.push(avatarModel)
244 246
245 this.actorImagesDone.add(id) 247 this.actorImagesDone.add(key)
246 } 248 }
247 249
248 private addThumbnail (row: SQLRow, videoModel: VideoModel) { 250 private addThumbnail (row: SQLRow, videoModel: VideoModel) {