aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/video-channel.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-05-31 16:30:11 +0200
committerChocobozzz <me@florianbigard.com>2019-05-31 16:44:46 +0200
commit7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c (patch)
treed2d2c9806dd1bf551ad39102149f514bca4c52eb /server/lib/video-channel.ts
parent9977c128387f38dddd697b2e9a405dcea52407b7 (diff)
downloadPeerTube-7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c.tar.gz
PeerTube-7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c.tar.zst
PeerTube-7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c.zip
Server: Bulk update videos support field
Diffstat (limited to 'server/lib/video-channel.ts')
-rw-r--r--server/lib/video-channel.ts16
1 files changed, 14 insertions, 2 deletions
diff --git a/server/lib/video-channel.ts b/server/lib/video-channel.ts
index 0fe95ca09..ee0482c36 100644
--- a/server/lib/video-channel.ts
+++ b/server/lib/video-channel.ts
@@ -3,7 +3,8 @@ import * as uuidv4 from 'uuid/v4'
3import { VideoChannelCreate } from '../../shared/models' 3import { VideoChannelCreate } from '../../shared/models'
4import { AccountModel } from '../models/account/account' 4import { AccountModel } from '../models/account/account'
5import { VideoChannelModel } from '../models/video/video-channel' 5import { VideoChannelModel } from '../models/video/video-channel'
6import { buildActorInstance, getVideoChannelActivityPubUrl } from './activitypub' 6import { buildActorInstance, federateVideoIfNeeded, getVideoChannelActivityPubUrl } from './activitypub'
7import { VideoModel } from '../models/video/video'
7 8
8async function createVideoChannel (videoChannelInfo: VideoChannelCreate, account: AccountModel, t: Sequelize.Transaction) { 9async function createVideoChannel (videoChannelInfo: VideoChannelCreate, account: AccountModel, t: Sequelize.Transaction) {
9 const uuid = uuidv4() 10 const uuid = uuidv4()
@@ -33,8 +34,19 @@ async function createVideoChannel (videoChannelInfo: VideoChannelCreate, account
33 return videoChannelCreated 34 return videoChannelCreated
34} 35}
35 36
37async function federateAllVideosOfChannel (videoChannel: VideoChannelModel) {
38 const videoIds = await VideoModel.getAllIdsFromChannel(videoChannel)
39
40 for (const videoId of videoIds) {
41 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId)
42
43 await federateVideoIfNeeded(video, false)
44 }
45}
46
36// --------------------------------------------------------------------------- 47// ---------------------------------------------------------------------------
37 48
38export { 49export {
39 createVideoChannel 50 createVideoChannel,
51 federateAllVideosOfChannel
40} 52}