diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-10 14:34:04 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-10 14:34:04 +0100 |
commit | 403c69c5a34e6db621f30c7b2bfb2b80dc8e74c1 (patch) | |
tree | 42831f62cdc211fe08ec1c817d13e1bb8d91ad39 /server/lib/activitypub/process | |
parent | d47044142417065c70cd6c731a500d97fbd306b5 (diff) | |
download | PeerTube-403c69c5a34e6db621f30c7b2bfb2b80dc8e74c1.tar.gz PeerTube-403c69c5a34e6db621f30c7b2bfb2b80dc8e74c1.tar.zst PeerTube-403c69c5a34e6db621f30c7b2bfb2b80dc8e74c1.zip |
Check threads resolve on non federated videos
Diffstat (limited to 'server/lib/activitypub/process')
-rw-r--r-- | server/lib/activitypub/process/process-create.ts | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts index f84992489..9cded4dec 100644 --- a/server/lib/activitypub/process/process-create.ts +++ b/server/lib/activitypub/process/process-create.ts | |||
@@ -91,6 +91,7 @@ async function processCreateVideoComment (activity: ActivityCreate, byActor: MAc | |||
91 | let comment: MCommentOwnerVideo | 91 | let comment: MCommentOwnerVideo |
92 | try { | 92 | try { |
93 | const resolveThreadResult = await resolveThread({ url: commentObject.id, isVideo: false }) | 93 | const resolveThreadResult = await resolveThread({ url: commentObject.id, isVideo: false }) |
94 | |||
94 | video = resolveThreadResult.video | 95 | video = resolveThreadResult.video |
95 | created = resolveThreadResult.commentCreated | 96 | created = resolveThreadResult.commentCreated |
96 | comment = resolveThreadResult.comment | 97 | comment = resolveThreadResult.comment |
@@ -104,16 +105,18 @@ async function processCreateVideoComment (activity: ActivityCreate, byActor: MAc | |||
104 | } | 105 | } |
105 | 106 | ||
106 | // Try to not forward unwanted commments on our videos | 107 | // Try to not forward unwanted commments on our videos |
107 | if (video.isOwned() && await isBlockedByServerOrAccount(comment.Account, video.VideoChannel.Account)) { | 108 | if (video.isOwned()) { |
108 | logger.info('Skip comment forward from blocked account or server %s.', comment.Account.Actor.url) | 109 | if (await isBlockedByServerOrAccount(comment.Account, video.VideoChannel.Account)) { |
109 | return | 110 | logger.info('Skip comment forward from blocked account or server %s.', comment.Account.Actor.url) |
110 | } | 111 | return |
112 | } | ||
111 | 113 | ||
112 | if (video.isOwned() && created === true) { | 114 | if (created === true) { |
113 | // Don't resend the activity to the sender | 115 | // Don't resend the activity to the sender |
114 | const exceptions = [ byActor ] | 116 | const exceptions = [ byActor ] |
115 | 117 | ||
116 | await forwardVideoRelatedActivity(activity, undefined, exceptions, video) | 118 | await forwardVideoRelatedActivity(activity, undefined, exceptions, video) |
119 | } | ||
117 | } | 120 | } |
118 | 121 | ||
119 | if (created && notify) Notifier.Instance.notifyOnNewComment(comment) | 122 | if (created && notify) Notifier.Instance.notifyOnNewComment(comment) |