aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r--server/lib/activitypub/videos.ts22
1 files changed, 9 insertions, 13 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index 5794988a5..893768769 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -204,19 +204,17 @@ async function updateVideoFromAP (options: {
204 overrideTo?: string[] 204 overrideTo?: string[]
205}) { 205}) {
206 logger.debug('Updating remote video "%s".', options.videoObject.uuid) 206 logger.debug('Updating remote video "%s".', options.videoObject.uuid)
207
207 let videoFieldsSave: any 208 let videoFieldsSave: any
209 const wasPrivateVideo = options.video.privacy === VideoPrivacy.PRIVATE
210 const wasUnlistedVideo = options.video.privacy === VideoPrivacy.UNLISTED
208 211
209 try { 212 try {
210 await sequelizeTypescript.transaction(async t => { 213 await sequelizeTypescript.transaction(async t => {
211 const sequelizeOptions = { 214 const sequelizeOptions = { transaction: t }
212 transaction: t
213 }
214 215
215 videoFieldsSave = options.video.toJSON() 216 videoFieldsSave = options.video.toJSON()
216 217
217 const wasPrivateVideo = options.video.privacy === VideoPrivacy.PRIVATE
218 const wasUnlistedVideo = options.video.privacy === VideoPrivacy.UNLISTED
219
220 // Check actor has the right to update the video 218 // Check actor has the right to update the video
221 const videoChannel = options.video.VideoChannel 219 const videoChannel = options.video.VideoChannel
222 if (videoChannel.Account.id !== options.account.id) { 220 if (videoChannel.Account.id !== options.account.id) {
@@ -281,15 +279,13 @@ async function updateVideoFromAP (options: {
281 }) 279 })
282 options.video.VideoCaptions = await Promise.all(videoCaptionsPromises) 280 options.video.VideoCaptions = await Promise.all(videoCaptionsPromises)
283 } 281 }
284
285 {
286 // Notify our users?
287 if (wasPrivateVideo || wasUnlistedVideo) {
288 Notifier.Instance.notifyOnNewVideo(options.video)
289 }
290 }
291 }) 282 })
292 283
284 // Notify our users?
285 if (wasPrivateVideo || wasUnlistedVideo) {
286 Notifier.Instance.notifyOnNewVideo(options.video)
287 }
288
293 logger.info('Remote video with uuid %s updated', options.videoObject.uuid) 289 logger.info('Remote video with uuid %s updated', options.videoObject.uuid)
294 } catch (err) { 290 } catch (err) {
295 if (options.video !== undefined && videoFieldsSave !== undefined) { 291 if (options.video !== undefined && videoFieldsSave !== undefined) {