aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/process/process-create.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/process/process-create.ts')
-rw-r--r--server/lib/activitypub/process/process-create.ts14
1 files changed, 11 insertions, 3 deletions
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts
index df05ee452..2e04ee843 100644
--- a/server/lib/activitypub/process/process-create.ts
+++ b/server/lib/activitypub/process/process-create.ts
@@ -13,6 +13,7 @@ import { forwardVideoRelatedActivity } from '../send/utils'
13import { Redis } from '../../redis' 13import { Redis } from '../../redis'
14import { createOrUpdateCacheFile } from '../cache-file' 14import { createOrUpdateCacheFile } from '../cache-file'
15import { getVideoDislikeActivityPubUrl } from '../url' 15import { getVideoDislikeActivityPubUrl } from '../url'
16import { Notifier } from '../../notifier'
16 17
17async function processCreateActivity (activity: ActivityCreate, byActor: ActorModel) { 18async function processCreateActivity (activity: ActivityCreate, byActor: ActorModel) {
18 const activityObject = activity.object 19 const activityObject = activity.object
@@ -47,7 +48,9 @@ export {
47async function processCreateVideo (activity: ActivityCreate) { 48async function processCreateVideo (activity: ActivityCreate) {
48 const videoToCreateData = activity.object as VideoTorrentObject 49 const videoToCreateData = activity.object as VideoTorrentObject
49 50
50 const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoToCreateData }) 51 const { video, created } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoToCreateData })
52
53 if (created) Notifier.Instance.notifyOnNewVideo(video)
51 54
52 return video 55 return video
53} 56}
@@ -133,7 +136,10 @@ async function processCreateVideoAbuse (byActor: ActorModel, videoAbuseToCreateD
133 state: VideoAbuseState.PENDING 136 state: VideoAbuseState.PENDING
134 } 137 }
135 138
136 await VideoAbuseModel.create(videoAbuseData, { transaction: t }) 139 const videoAbuseInstance = await VideoAbuseModel.create(videoAbuseData, { transaction: t })
140 videoAbuseInstance.Video = video
141
142 Notifier.Instance.notifyOnNewVideoAbuse(videoAbuseInstance)
137 143
138 logger.info('Remote abuse for video uuid %s created', videoAbuseToCreateData.object) 144 logger.info('Remote abuse for video uuid %s created', videoAbuseToCreateData.object)
139 }) 145 })
@@ -147,7 +153,7 @@ async function processCreateVideoComment (byActor: ActorModel, activity: Activit
147 153
148 const { video } = await resolveThread(commentObject.inReplyTo) 154 const { video } = await resolveThread(commentObject.inReplyTo)
149 155
150 const { created } = await addVideoComment(video, commentObject.id) 156 const { comment, created } = await addVideoComment(video, commentObject.id)
151 157
152 if (video.isOwned() && created === true) { 158 if (video.isOwned() && created === true) {
153 // Don't resend the activity to the sender 159 // Don't resend the activity to the sender
@@ -155,4 +161,6 @@ async function processCreateVideoComment (byActor: ActorModel, activity: Activit
155 161
156 await forwardVideoRelatedActivity(activity, undefined, exceptions, video) 162 await forwardVideoRelatedActivity(activity, undefined, exceptions, video)
157 } 163 }
164
165 if (created === true) Notifier.Instance.notifyOnNewComment(comment)
158} 166}