diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-26 16:26:27 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-03-03 10:08:08 +0100 |
commit | 74d249bc1346c7cfaac7ee49bebbebcf2a01f82a (patch) | |
tree | d47bd163ae57ed8f15b445296634cc04f4f67b6f /server/lib/activitypub/video-comments.ts | |
parent | 095e2258043fcff8a79ab082d11edfbd8f13a8e2 (diff) | |
download | PeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.tar.gz PeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.tar.zst PeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.zip |
Add ability to cleanup remote AP interactions
Diffstat (limited to 'server/lib/activitypub/video-comments.ts')
-rw-r--r-- | server/lib/activitypub/video-comments.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts index 902d877c4..d025ed7f1 100644 --- a/server/lib/activitypub/video-comments.ts +++ b/server/lib/activitypub/video-comments.ts | |||
@@ -41,10 +41,10 @@ async function resolveThread (params: ResolveThreadParams): ResolveThreadResult | |||
41 | return await tryResolveThreadFromVideo(params) | 41 | return await tryResolveThreadFromVideo(params) |
42 | } | 42 | } |
43 | } catch (err) { | 43 | } catch (err) { |
44 | logger.debug('Cannot get or create account and video and channel for reply %s, fetch comment', url, { err }) | 44 | logger.debug('Cannot resolve thread from video %s, maybe because it was not a video', url, { err }) |
45 | } | 45 | } |
46 | 46 | ||
47 | return resolveParentComment(params) | 47 | return resolveRemoteParentComment(params) |
48 | } | 48 | } |
49 | 49 | ||
50 | export { | 50 | export { |
@@ -119,7 +119,7 @@ async function tryResolveThreadFromVideo (params: ResolveThreadParams) { | |||
119 | return { video, comment: resultComment, commentCreated } | 119 | return { video, comment: resultComment, commentCreated } |
120 | } | 120 | } |
121 | 121 | ||
122 | async function resolveParentComment (params: ResolveThreadParams) { | 122 | async function resolveRemoteParentComment (params: ResolveThreadParams) { |
123 | const { url, comments } = params | 123 | const { url, comments } = params |
124 | 124 | ||
125 | if (comments.length > ACTIVITY_PUB.MAX_RECURSION_COMMENTS) { | 125 | if (comments.length > ACTIVITY_PUB.MAX_RECURSION_COMMENTS) { |
@@ -133,7 +133,7 @@ async function resolveParentComment (params: ResolveThreadParams) { | |||
133 | }) | 133 | }) |
134 | 134 | ||
135 | if (sanitizeAndCheckVideoCommentObject(body) === false) { | 135 | if (sanitizeAndCheckVideoCommentObject(body) === false) { |
136 | throw new Error('Remote video comment JSON is not valid:' + JSON.stringify(body)) | 136 | throw new Error(`Remote video comment JSON ${url} is not valid:` + JSON.stringify(body)) |
137 | } | 137 | } |
138 | 138 | ||
139 | const actorUrl = body.attributedTo | 139 | const actorUrl = body.attributedTo |