aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-26 10:20:58 +0200
committerChocobozzz <me@florianbigard.com>2019-05-13 09:45:36 +0200
commita18f275d302bbd95443c258b8d92f6dfd8eb1653 (patch)
tree2cf4362ce6fd8580eca070c5ca74f33e1356a0c9
parentc342726ad4ccbb90b8ff29f1cc1c89f9f7e8d98f (diff)
downloadPeerTube-a18f275d302bbd95443c258b8d92f6dfd8eb1653.tar.gz
PeerTube-a18f275d302bbd95443c258b8d92f6dfd8eb1653.tar.zst
PeerTube-a18f275d302bbd95443c258b8d92f6dfd8eb1653.zip
Fix thumbnail when listing my videos
-rw-r--r--server/models/video/video.ts16
-rw-r--r--server/tests/api/users/users.ts7
2 files changed, 11 insertions, 12 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 4e6f602aa..c0a7892a4 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -1126,15 +1126,11 @@ export class VideoModel extends Model<VideoModel> {
1126 const countQuery = buildBaseQuery() 1126 const countQuery = buildBaseQuery()
1127 const findQuery = buildBaseQuery() 1127 const findQuery = buildBaseQuery()
1128 1128
1129 findQuery.include.push({ 1129 const findScopes = [
1130 model: ScheduleVideoUpdateModel, 1130 ScopeNames.WITH_SCHEDULED_UPDATE,
1131 required: false 1131 ScopeNames.WITH_BLACKLISTED,
1132 }) 1132 ScopeNames.WITH_THUMBNAILS
1133 1133 ]
1134 findQuery.include.push({
1135 model: VideoBlacklistModel,
1136 required: false
1137 })
1138 1134
1139 if (withFiles === true) { 1135 if (withFiles === true) {
1140 findQuery.include.push({ 1136 findQuery.include.push({
@@ -1145,7 +1141,7 @@ export class VideoModel extends Model<VideoModel> {
1145 1141
1146 return Promise.all([ 1142 return Promise.all([
1147 VideoModel.count(countQuery), 1143 VideoModel.count(countQuery),
1148 VideoModel.findAll(findQuery) 1144 VideoModel.scope(findScopes).findAll(findQuery)
1149 ]).then(([ count, rows ]) => { 1145 ]).then(([ count, rows ]) => {
1150 return { 1146 return {
1151 data: rows, 1147 data: rows,
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index e7291740b..c8e32f3f5 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -2,7 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { User, UserRole } from '../../../../shared/index' 5import { User, UserRole, Video } from '../../../../shared/index'
6import { 6import {
7 blockUser, 7 blockUser,
8 cleanupTests, 8 cleanupTests,
@@ -290,7 +290,10 @@ describe('Test users', function () {
290 const videos = res.body.data 290 const videos = res.body.data
291 expect(videos).to.have.lengthOf(1) 291 expect(videos).to.have.lengthOf(1)
292 292
293 expect(videos[ 0 ].name).to.equal('super user video') 293 const video: Video = videos[ 0 ]
294 expect(video.name).to.equal('super user video')
295 expect(video.thumbnailPath).to.not.be.null
296 expect(video.previewPath).to.not.be.null
294 }) 297 })
295 }) 298 })
296 299