aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-25 18:05:54 +0200
committerChocobozzz <me@florianbigard.com>2018-09-25 18:05:54 +0200
commit4a08f6692780fa5147d85126af3089fc7891e436 (patch)
treeaa65e7649929de46fb3add06dba5550da7232000 /server/models
parentc922d14220eed241d47677db8441921935435f0c (diff)
downloadPeerTube-4a08f6692780fa5147d85126af3089fc7891e436.tar.gz
PeerTube-4a08f6692780fa5147d85126af3089fc7891e436.tar.zst
PeerTube-4a08f6692780fa5147d85126af3089fc7891e436.zip
Only duplicate public videos
Diffstat (limited to 'server/models')
-rw-r--r--server/models/redundancy/video-redundancy.ts9
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'
21import { VideoModel } from '../video/video' 21import { VideoModel } from '../video/video'
22import { VideoRedundancyStrategy } from '../../../shared/models/redundancy' 22import { VideoRedundancyStrategy } from '../../../shared/models/redundancy'
23import { logger } from '../../helpers/logger' 23import { logger } from '../../helpers/logger'
24import { CacheFileObject } from '../../../shared' 24import { CacheFileObject, VideoPrivacy } from '../../../shared'
25import { VideoChannelModel } from '../video/video-channel' 25import { VideoChannelModel } from '../video/video-channel'
26import { ServerModel } from '../server/server' 26import { ServerModel } from '../server/server'
27import { sample } from 'lodash' 27import { 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 }