X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fprocess%2Fprocess-delete.ts;h=a86def936f0db9d351eca84fe652b816121f6913;hb=0d8de2756fdc43be61a82a96c17d12ee52ba0143;hp=b9fc5e792bfa4838c410f936bbfdba9a85313ded;hpb=e0fea785bf28966da09cdc16a274c9e750b488f4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts index b9fc5e792..a86def936 100644 --- a/server/lib/activitypub/process/process-delete.ts +++ b/server/lib/activitypub/process/process-delete.ts @@ -5,11 +5,11 @@ import { sequelizeTypescript } from '../../../initializers/database' import { ActorModel } from '../../../models/activitypub/actor' import { VideoModel } from '../../../models/video/video' import { VideoCommentModel } from '../../../models/video/video-comment' -import { markCommentAsDeleted } from '../../video-comment' -import { forwardVideoRelatedActivity } from '../send/utils' import { VideoPlaylistModel } from '../../../models/video/video-playlist' import { APProcessorOptions } from '../../../types/activitypub-processor.model' -import { MAccountActor, MActor, MActorSignature, MChannelActor, MChannelActorAccountActor } from '../../../types/models' +import { MAccountActor, MActor, MActorSignature, MChannelActor, MChannelActorAccountActor, MCommentOwnerVideo } from '../../../types/models' +import { markCommentAsDeleted } from '../../video-comment' +import { forwardVideoRelatedActivity } from '../send/utils' async function processDeleteActivity (options: APProcessorOptions) { const { activity, byActor } = options @@ -121,7 +121,10 @@ async function processDeleteVideoChannel (videoChannelToRemove: MChannelActor) { logger.info('Remote video channel %s removed.', videoChannelToRemove.Actor.url) } -function processDeleteVideoComment (byActor: MActorSignature, videoComment: VideoCommentModel, activity: ActivityDelete) { +function processDeleteVideoComment (byActor: MActorSignature, videoComment: MCommentOwnerVideo, activity: ActivityDelete) { + // Already deleted + if (videoComment.isDeleted()) return + logger.debug('Removing remote video comment "%s".', videoComment.url) return sequelizeTypescript.transaction(async t => {