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 { getAPId } from '../../../helpers/activitypub'
+import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
+import { AbuseObject, AbuseState, ActivityCreate, ActivityFlag } from '@shared/models'
import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger'
import { sequelizeTypescript } from '../../../initializers/database'
+import { getAPId } from '../../../lib/activitypub/activity'
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MAccountDefault, MActorSignature, MCommentOwnerVideo } from '../../../types/models'
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)
endAt,
reporterAccount,
transaction: t,
- videoInstance: video
+ videoInstance: video,
+ skipNotification: false
})
}
baseAbuse,
reporterAccount,
transaction: t,
- commentInstance: videoComment
+ commentInstance: videoComment,
+ skipNotification: false
})
}
baseAbuse,
reporterAccount,
transaction: t,
- accountInstance: flaggedAccount
+ accountInstance: flaggedAccount,
+ skipNotification: false
})
})
} catch (err) {