aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/models/video/video.ts10
-rw-r--r--server/tests/api/users/users.ts7
2 files changed, 13 insertions, 4 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index d216ed47d..e6a8d3f95 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -972,7 +972,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
972 }) { 972 }) {
973 const { accountId, channelId, start, count, sort, search, isLive } = options 973 const { accountId, channelId, start, count, sort, search, isLive } = options
974 974
975 function buildBaseQuery (): FindOptions { 975 function buildBaseQuery (forCount: boolean): FindOptions {
976 const where: WhereOptions = {} 976 const where: WhereOptions = {}
977 977
978 if (search) { 978 if (search) {
@@ -1001,7 +1001,9 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1001 where: channelWhere, 1001 where: channelWhere,
1002 include: [ 1002 include: [
1003 { 1003 {
1004 model: AccountModel, 1004 model: forCount
1005 ? AccountModel.unscoped()
1006 : AccountModel,
1005 where: { 1007 where: {
1006 id: accountId 1008 id: accountId
1007 }, 1009 },
@@ -1015,8 +1017,8 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1015 return baseQuery 1017 return baseQuery
1016 } 1018 }
1017 1019
1018 const countQuery = buildBaseQuery() 1020 const countQuery = buildBaseQuery(true)
1019 const findQuery = buildBaseQuery() 1021 const findQuery = buildBaseQuery(false)
1020 1022
1021 const findScopes: (string | ScopeOptions)[] = [ 1023 const findScopes: (string | ScopeOptions)[] = [
1022 ScopeNames.WITH_SCHEDULED_UPDATE, 1024 ScopeNames.WITH_SCHEDULED_UPDATE,
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index a47713bf0..01b4c2eab 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -622,6 +622,13 @@ describe('Test users', function () {
622 } 622 }
623 }) 623 })
624 624
625 it('Should still have the same amount of videos in my account', async function () {
626 const { total, data } = await server.videos.listMyVideos({ token: userToken })
627
628 expect(total).to.equal(2)
629 expect(data).to.have.lengthOf(2)
630 })
631
625 it('Should be able to update my display name', async function () { 632 it('Should be able to update my display name', async function () {
626 await server.users.updateMe({ token: userToken, displayName: 'new display name' }) 633 await server.users.updateMe({ token: userToken, displayName: 'new display name' })
627 634