Fix getting avatars in videos list
This commit is contained in:
parent
f41efa52a4
commit
242f52253e
|
@ -234,15 +234,17 @@ export class VideoModelBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private addActorAvatar (row: SQLRow, actorPrefix: string, actor: ActorModel) {
|
private addActorAvatar (row: SQLRow, actorPrefix: string, actor: ActorModel) {
|
||||||
const avatarPrefix = `${actorPrefix}.Avatar`
|
const avatarPrefix = `${actorPrefix}.Avatars`
|
||||||
const id = row[`${avatarPrefix}.id`]
|
const id = row[`${avatarPrefix}.id`]
|
||||||
if (!id || this.actorImagesDone.has(id)) return
|
const key = `${row.id}${id}`
|
||||||
|
|
||||||
|
if (!id || this.actorImagesDone.has(key)) return
|
||||||
|
|
||||||
const attributes = this.grab(row, this.tables.getAvatarAttributes(), avatarPrefix)
|
const attributes = this.grab(row, this.tables.getAvatarAttributes(), avatarPrefix)
|
||||||
const avatarModel = new ActorImageModel(attributes, this.buildOpts)
|
const avatarModel = new ActorImageModel(attributes, this.buildOpts)
|
||||||
actor.Avatars.push(avatarModel)
|
actor.Avatars.push(avatarModel)
|
||||||
|
|
||||||
this.actorImagesDone.add(id)
|
this.actorImagesDone.add(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
private addThumbnail (row: SQLRow, videoModel: VideoModel) {
|
private addThumbnail (row: SQLRow, videoModel: VideoModel) {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
|
import { and } from 'sequelize/dist'
|
||||||
import request from 'supertest'
|
import request from 'supertest'
|
||||||
import {
|
import {
|
||||||
checkTmpIsEmpty,
|
checkTmpIsEmpty,
|
||||||
|
@ -17,6 +18,7 @@ import {
|
||||||
cleanupTests,
|
cleanupTests,
|
||||||
createMultipleServers,
|
createMultipleServers,
|
||||||
doubleFollow,
|
doubleFollow,
|
||||||
|
makeGetRequest,
|
||||||
PeerTubeServer,
|
PeerTubeServer,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
setDefaultAccountAvatar,
|
setDefaultAccountAvatar,
|
||||||
|
@ -138,6 +140,22 @@ describe('Test multiple servers', function () {
|
||||||
|
|
||||||
await completeVideoCheck(server, video, checkAttributes)
|
await completeVideoCheck(server, video, checkAttributes)
|
||||||
publishedAt = video.publishedAt as string
|
publishedAt = video.publishedAt as string
|
||||||
|
|
||||||
|
expect(video.channel.avatars).to.have.lengthOf(2)
|
||||||
|
expect(video.account.avatars).to.have.lengthOf(2)
|
||||||
|
|
||||||
|
for (const image of [ ...video.channel.avatars, ...video.account.avatars ]) {
|
||||||
|
expect(image.createdAt).to.exist
|
||||||
|
expect(image.updatedAt).to.exist
|
||||||
|
expect(image.width).to.be.above(20).and.below(1000)
|
||||||
|
expect(image.path).to.exist
|
||||||
|
|
||||||
|
await makeGetRequest({
|
||||||
|
url: server.url,
|
||||||
|
path: image.path,
|
||||||
|
expectedStatus: HttpStatusCode.OK_200
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue