From 03e12d7c4954e1071fdeb7ef362ea5c3965d4075 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Apr 2018 14:32:19 +0200 Subject: Add account link in videos list --- server/models/video/video.ts | 6 ++++-- server/tests/utils/videos/videos.ts | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/models/video/video.ts b/server/models/video/video.ts index f23fac2ab..ea466fccd 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -104,13 +104,13 @@ enum ScopeNames { videoChannelId?: number }) => { const accountInclude = { - attributes: [ 'name' ], + attributes: [ 'id', 'name' ], model: AccountModel.unscoped(), required: true, where: {}, include: [ { - attributes: [ 'preferredUsername', 'url', 'serverId', 'avatarId' ], + attributes: [ 'id', 'uuid', 'preferredUsername', 'url', 'serverId', 'avatarId' ], model: ActorModel.unscoped(), required: true, where: VideoModel.buildActorWhereWithFilter(options.filter), @@ -1078,6 +1078,8 @@ export class VideoModel extends Model { updatedAt: this.updatedAt, publishedAt: this.publishedAt, account: { + id: formattedAccount.id, + uuid: formattedAccount.uuid, name: formattedAccount.name, displayName: formattedAccount.displayName, url: formattedAccount.url, diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 2ba3a860b..d1d8c07df 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts @@ -486,6 +486,8 @@ async function completeVideoCheck ( expect(video.privacy.label).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy]) expect(video.nsfw).to.equal(attributes.nsfw) expect(video.description).to.equal(attributes.description) + expect(video.account.id).to.be.a('number') + expect(video.account.uuid).to.be.a('string') expect(video.account.host).to.equal(attributes.account.host) expect(video.account.name).to.equal(attributes.account.name) expect(video.likes).to.equal(attributes.likes) -- cgit v1.2.3