diff options
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 91ab8c66a..d6934748f 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -11,7 +11,7 @@ import { | |||
11 | resetSequelizeInstance, | 11 | resetSequelizeInstance, |
12 | retryTransactionWrapper | 12 | retryTransactionWrapper |
13 | } from '../../../helpers' | 13 | } from '../../../helpers' |
14 | import { getServerAccount } from '../../../helpers/utils' | 14 | import { getServerActor } from '../../../helpers/utils' |
15 | import { | 15 | import { |
16 | CONFIG, | 16 | CONFIG, |
17 | sequelizeTypescript, | 17 | sequelizeTypescript, |
@@ -22,8 +22,7 @@ import { | |||
22 | VIDEO_PRIVACIES | 22 | VIDEO_PRIVACIES |
23 | } from '../../../initializers' | 23 | } from '../../../initializers' |
24 | import { fetchRemoteVideoDescription, getVideoActivityPubUrl, shareVideoByServer } from '../../../lib/activitypub' | 24 | import { fetchRemoteVideoDescription, getVideoActivityPubUrl, shareVideoByServer } from '../../../lib/activitypub' |
25 | import { sendAddVideo, sendCreateViewToOrigin, sendUpdateVideo } from '../../../lib/activitypub/send' | 25 | import { sendCreateVideo, sendCreateViewToOrigin, sendCreateViewToVideoFollowers, sendUpdateVideo } from '../../../lib/activitypub/send' |
26 | import { sendCreateViewToVideoFollowers } from '../../../lib/index' | ||
27 | import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler' | 26 | import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler' |
28 | import { | 27 | import { |
29 | asyncMiddleware, | 28 | asyncMiddleware, |
@@ -248,7 +247,8 @@ async function addVideo (req: express.Request, res: express.Response, videoPhysi | |||
248 | // Don't send video to remote servers, it is private | 247 | // Don't send video to remote servers, it is private |
249 | if (video.privacy === VideoPrivacy.PRIVATE) return videoCreated | 248 | if (video.privacy === VideoPrivacy.PRIVATE) return videoCreated |
250 | 249 | ||
251 | await sendAddVideo(video, t) | 250 | await sendCreateVideo(video, t) |
251 | // TODO: share by video channel | ||
252 | await shareVideoByServer(video, t) | 252 | await shareVideoByServer(video, t) |
253 | 253 | ||
254 | logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoCreated.uuid) | 254 | logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoCreated.uuid) |
@@ -304,7 +304,8 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
304 | 304 | ||
305 | // Video is not private anymore, send a create action to remote servers | 305 | // Video is not private anymore, send a create action to remote servers |
306 | if (wasPrivateVideo === true && videoInstanceUpdated.privacy !== VideoPrivacy.PRIVATE) { | 306 | if (wasPrivateVideo === true && videoInstanceUpdated.privacy !== VideoPrivacy.PRIVATE) { |
307 | await sendAddVideo(videoInstanceUpdated, t) | 307 | await sendCreateVideo(videoInstanceUpdated, t) |
308 | // TODO: Send by video channel | ||
308 | await shareVideoByServer(videoInstanceUpdated, t) | 309 | await shareVideoByServer(videoInstanceUpdated, t) |
309 | } | 310 | } |
310 | }) | 311 | }) |
@@ -330,7 +331,7 @@ async function viewVideo (req: express.Request, res: express.Response) { | |||
330 | const videoInstance = res.locals.video | 331 | const videoInstance = res.locals.video |
331 | 332 | ||
332 | await videoInstance.increment('views') | 333 | await videoInstance.increment('views') |
333 | const serverAccount = await getServerAccount() | 334 | const serverAccount = await getServerActor() |
334 | 335 | ||
335 | if (videoInstance.isOwned()) { | 336 | if (videoInstance.isOwned()) { |
336 | await sendCreateViewToVideoFollowers(serverAccount, videoInstance, undefined) | 337 | await sendCreateViewToVideoFollowers(serverAccount, videoInstance, undefined) |