- if (parents.length !== 0) {
- const parent = parents[0]
-
- originCommentId = parent.getThreadId()
- inReplyToCommentId = parent.id
- }
-
- // This is a new thread
- const objectToCreate = {
- url: comment.id,
- text: comment.content,
- originCommentId,
- inReplyToCommentId,
- videoId: video.id,
- accountId: byAccount.id
- }
-
- const options = {
- where: {
- url: objectToCreate.url
- },
- defaults: objectToCreate,
- transaction: t
- }
- const [ ,created ] = await VideoCommentModel.findOrCreate(options)
-
- if (video.isOwned() && created === true) {
- // Don't resend the activity to the sender
- const exceptions = [ byActor ]
-
- // Mastodon does not add our announces in audience, so we forward to them manually
- const additionalActors = await getActorsInvolvedInVideo(video, t)
- const additionalFollowerUrls = additionalActors.map(a => a.followersUrl)
-
- await forwardActivity(activity, t, exceptions, additionalFollowerUrls)
- }
- })