diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-25 18:05:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-25 18:05:54 +0200 |
commit | 4a08f6692780fa5147d85126af3089fc7891e436 (patch) | |
tree | aa65e7649929de46fb3add06dba5550da7232000 /server/models/redundancy | |
parent | c922d14220eed241d47677db8441921935435f0c (diff) | |
download | PeerTube-4a08f6692780fa5147d85126af3089fc7891e436.tar.gz PeerTube-4a08f6692780fa5147d85126af3089fc7891e436.tar.zst PeerTube-4a08f6692780fa5147d85126af3089fc7891e436.zip |
Only duplicate public videos
Diffstat (limited to 'server/models/redundancy')
-rw-r--r-- | server/models/redundancy/video-redundancy.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index 58c4f354c..3c87ec2c1 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts | |||
@@ -21,7 +21,7 @@ import { getServerActor } from '../../helpers/utils' | |||
21 | import { VideoModel } from '../video/video' | 21 | import { VideoModel } from '../video/video' |
22 | import { VideoRedundancyStrategy } from '../../../shared/models/redundancy' | 22 | import { VideoRedundancyStrategy } from '../../../shared/models/redundancy' |
23 | import { logger } from '../../helpers/logger' | 23 | import { logger } from '../../helpers/logger' |
24 | import { CacheFileObject } from '../../../shared' | 24 | import { CacheFileObject, VideoPrivacy } from '../../../shared' |
25 | import { VideoChannelModel } from '../video/video-channel' | 25 | import { VideoChannelModel } from '../video/video-channel' |
26 | import { ServerModel } from '../server/server' | 26 | import { ServerModel } from '../server/server' |
27 | import { sample } from 'lodash' | 27 | import { sample } from 'lodash' |
@@ -160,6 +160,9 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> { | |||
160 | attributes: [ 'id', 'views' ], | 160 | attributes: [ 'id', 'views' ], |
161 | limit: randomizedFactor, | 161 | limit: randomizedFactor, |
162 | order: getVideoSort('-views'), | 162 | order: getVideoSort('-views'), |
163 | where: { | ||
164 | privacy: VideoPrivacy.PUBLIC | ||
165 | }, | ||
163 | include: [ | 166 | include: [ |
164 | await VideoRedundancyModel.buildVideoFileForDuplication(), | 167 | await VideoRedundancyModel.buildVideoFileForDuplication(), |
165 | VideoRedundancyModel.buildServerRedundancyInclude() | 168 | VideoRedundancyModel.buildServerRedundancyInclude() |
@@ -177,6 +180,9 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> { | |||
177 | group: 'VideoModel.id', | 180 | group: 'VideoModel.id', |
178 | limit: randomizedFactor, | 181 | limit: randomizedFactor, |
179 | order: getVideoSort('-trending'), | 182 | order: getVideoSort('-trending'), |
183 | where: { | ||
184 | privacy: VideoPrivacy.PUBLIC | ||
185 | }, | ||
180 | include: [ | 186 | include: [ |
181 | await VideoRedundancyModel.buildVideoFileForDuplication(), | 187 | await VideoRedundancyModel.buildVideoFileForDuplication(), |
182 | VideoRedundancyModel.buildServerRedundancyInclude(), | 188 | VideoRedundancyModel.buildServerRedundancyInclude(), |
@@ -195,6 +201,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> { | |||
195 | limit: randomizedFactor, | 201 | limit: randomizedFactor, |
196 | order: getVideoSort('-publishedAt'), | 202 | order: getVideoSort('-publishedAt'), |
197 | where: { | 203 | where: { |
204 | privacy: VideoPrivacy.PUBLIC, | ||
198 | views: { | 205 | views: { |
199 | [ Sequelize.Op.gte ]: minViews | 206 | [ Sequelize.Op.gte ]: minViews |
200 | } | 207 | } |