diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/video-comments.ts | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts index 3e8306fa4..1a15842cf 100644 --- a/server/lib/activitypub/video-comments.ts +++ b/server/lib/activitypub/video-comments.ts | |||
@@ -131,9 +131,9 @@ async function resolveParentComment (params: ResolveThreadParams) { | |||
131 | } | 131 | } |
132 | 132 | ||
133 | const actorUrl = body.attributedTo | 133 | const actorUrl = body.attributedTo |
134 | if (!actorUrl) throw new Error('Miss attributed to in comment') | 134 | if (!actorUrl && body.type !== 'Tombstone') throw new Error('Miss attributed to in comment') |
135 | 135 | ||
136 | if (checkUrlsSameHost(url, actorUrl) !== true) { | 136 | if (actorUrl && checkUrlsSameHost(url, actorUrl) !== true) { |
137 | throw new Error(`Actor url ${actorUrl} has not the same host than the comment url ${url}`) | 137 | throw new Error(`Actor url ${actorUrl} has not the same host than the comment url ${url}`) |
138 | } | 138 | } |
139 | 139 | ||
@@ -141,18 +141,19 @@ async function resolveParentComment (params: ResolveThreadParams) { | |||
141 | throw new Error(`Comment url ${url} host is different from the AP object id ${body.id}`) | 141 | throw new Error(`Comment url ${url} host is different from the AP object id ${body.id}`) |
142 | } | 142 | } |
143 | 143 | ||
144 | const actor = await getOrCreateActorAndServerAndModel(actorUrl, 'all') | 144 | const actor = actorUrl ? await getOrCreateActorAndServerAndModel(actorUrl, 'all') : null |
145 | const comment = new VideoCommentModel({ | 145 | const comment = new VideoCommentModel({ |
146 | url: body.id, | 146 | url: body.id, |
147 | text: body.content, | 147 | text: body.content ? body.content : '', |
148 | videoId: null, | 148 | videoId: null, |
149 | accountId: actor.Account.id, | 149 | accountId: actor ? actor.Account.id : null, |
150 | inReplyToCommentId: null, | 150 | inReplyToCommentId: null, |
151 | originCommentId: null, | 151 | originCommentId: null, |
152 | createdAt: new Date(body.published), | 152 | createdAt: new Date(body.published), |
153 | updatedAt: new Date(body.updated) | 153 | updatedAt: new Date(body.updated), |
154 | deletedAt: body.deleted ? new Date(body.deleted) : null | ||
154 | }) as MCommentOwner | 155 | }) as MCommentOwner |
155 | comment.Account = actor.Account | 156 | comment.Account = actor ? actor.Account : null |
156 | 157 | ||
157 | return resolveThread({ | 158 | return resolveThread({ |
158 | url: body.inReplyTo, | 159 | url: body.inReplyTo, |