X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fprocess%2Fprocess-flag.ts;h=fd3e46e2b4a4333995fa1c2d3092b07f0102fafc;hb=fa66c9a601d69f6d57c956a3513e8bbed7ee9616;hp=6350cee12816e92f8277f168b40d10e9222d4375;hpb=2291a412d25bd139398ca9e7a5131d0c1e4ffd7d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/process/process-flag.ts b/server/lib/activitypub/process/process-flag.ts index 6350cee12..fd3e46e2b 100644 --- a/server/lib/activitypub/process/process-flag.ts +++ b/server/lib/activitypub/process/process-flag.ts @@ -2,7 +2,8 @@ import { createAccountAbuse, createVideoAbuse, createVideoCommentAbuse } from '@ import { AccountModel } from '@server/models/account/account' import { VideoModel } from '@server/models/video/video' import { VideoCommentModel } from '@server/models/video/video-comment' -import { AbuseObject, abusePredefinedReasonsMap, AbuseState, ActivityCreate, ActivityFlag } from '../../../../shared' +import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' +import { AbuseObject, AbuseState, ActivityCreate, ActivityFlag } from '../../../../shared' import { getAPId } from '../../../helpers/activitypub' import { retryTransactionWrapper } from '../../../helpers/database-utils' import { logger } from '../../../helpers/logger' @@ -48,13 +49,12 @@ async function processCreateAbuse (activity: ActivityCreate | ActivityFlag, byAc logger.debug('Reporting remote abuse for object %s.', uri) await sequelizeTypescript.transaction(async t => { - - const video = await VideoModel.loadByUrlAndPopulateAccount(uri) + const video = await VideoModel.loadByUrlAndPopulateAccount(uri, t) let videoComment: MCommentOwnerVideo let flaggedAccount: MAccountDefault - if (!video) videoComment = await VideoCommentModel.loadByUrlAndPopulateAccountAndVideo(uri) - if (!videoComment) flaggedAccount = await AccountModel.loadByUrl(uri) + if (!video) videoComment = await VideoCommentModel.loadByUrlAndPopulateAccountAndVideo(uri, t) + if (!videoComment) flaggedAccount = await AccountModel.loadByUrl(uri, t) if (!video && !videoComment && !flaggedAccount) { logger.warn('Cannot flag unknown entity %s.', object) @@ -75,7 +75,8 @@ async function processCreateAbuse (activity: ActivityCreate | ActivityFlag, byAc endAt, reporterAccount, transaction: t, - videoInstance: video + videoInstance: video, + skipNotification: false }) } @@ -84,7 +85,8 @@ async function processCreateAbuse (activity: ActivityCreate | ActivityFlag, byAc baseAbuse, reporterAccount, transaction: t, - commentInstance: videoComment + commentInstance: videoComment, + skipNotification: false }) } @@ -92,7 +94,8 @@ async function processCreateAbuse (activity: ActivityCreate | ActivityFlag, byAc baseAbuse, reporterAccount, transaction: t, - accountInstance: flaggedAccount + accountInstance: flaggedAccount, + skipNotification: false }) }) } catch (err) {