aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/lib/activitypub/send/send-undo.ts9
-rw-r--r--server/lib/activitypub/send/send-update.ts8
-rw-r--r--server/models/redundancy/video-redundancy.ts4
3 files changed, 17 insertions, 4 deletions
diff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.ts
index 352c158fd..d2b738bef 100644
--- a/server/lib/activitypub/send/send-undo.ts
+++ b/server/lib/activitypub/send/send-undo.ts
@@ -79,8 +79,13 @@ async function sendUndoDislike (byActor: MActor, video: MVideoAccountLight, t: T
79async function sendUndoCacheFile (byActor: MActor, redundancyModel: MVideoRedundancyVideo, t: Transaction) { 79async function sendUndoCacheFile (byActor: MActor, redundancyModel: MVideoRedundancyVideo, t: Transaction) {
80 logger.info('Creating job to undo cache file %s.', redundancyModel.url) 80 logger.info('Creating job to undo cache file %s.', redundancyModel.url)
81 81
82 const videoId = redundancyModel.getVideo().id 82 const associatedVideo = redundancyModel.getVideo()
83 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId) 83 if (!associatedVideo) {
84 logger.warn('Cannot send undo activity for redundancy %s: no video files associated.', redundancyModel.url)
85 return
86 }
87
88 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(associatedVideo.id)
84 const createActivity = buildCreateActivity(redundancyModel.url, byActor, redundancyModel.toActivityPubObject()) 89 const createActivity = buildCreateActivity(redundancyModel.url, byActor, redundancyModel.toActivityPubObject())
85 90
86 return sendUndoVideoRelatedActivity({ byActor, video, url: redundancyModel.url, activity: createActivity, transaction: t }) 91 return sendUndoVideoRelatedActivity({ byActor, video, url: redundancyModel.url, activity: createActivity, transaction: t })
diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts
index 305edf429..bcf6e1569 100644
--- a/server/lib/activitypub/send/send-update.ts
+++ b/server/lib/activitypub/send/send-update.ts
@@ -75,7 +75,13 @@ async function sendUpdateActor (accountOrChannel: MChannelDefault | MAccountDefa
75async function sendUpdateCacheFile (byActor: MActorLight, redundancyModel: MVideoRedundancyVideo) { 75async function sendUpdateCacheFile (byActor: MActorLight, redundancyModel: MVideoRedundancyVideo) {
76 logger.info('Creating job to update cache file %s.', redundancyModel.url) 76 logger.info('Creating job to update cache file %s.', redundancyModel.url)
77 77
78 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(redundancyModel.getVideo().id) 78 const associatedVideo = redundancyModel.getVideo()
79 if (!associatedVideo) {
80 logger.warn('Cannot send update activity for redundancy %s: no video files associated.', redundancyModel.url)
81 return
82 }
83
84 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(associatedVideo.id)
79 85
80 const activityBuilder = (audience: ActivityAudience) => { 86 const activityBuilder = (audience: ActivityAudience) => {
81 const redundancyObject = redundancyModel.toActivityPubObject() 87 const redundancyObject = redundancyModel.toActivityPubObject()
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts
index fa96a1e39..c536c288b 100644
--- a/server/models/redundancy/video-redundancy.ts
+++ b/server/models/redundancy/video-redundancy.ts
@@ -651,7 +651,9 @@ export class VideoRedundancyModel extends Model {
651 getVideo () { 651 getVideo () {
652 if (this.VideoFile) return this.VideoFile.Video 652 if (this.VideoFile) return this.VideoFile.Video
653 653
654 return this.VideoStreamingPlaylist.Video 654 if (this.VideoStreamingPlaylist.Video) return this.VideoStreamingPlaylist.Video
655
656 return undefined
655 } 657 }
656 658
657 isOwned () { 659 isOwned () {