-import * as express from 'express'
+import express from 'express'
import { logger } from '@server/helpers/logger'
import { createAccountAbuse, createVideoAbuse, createVideoCommentAbuse } from '@server/lib/moderation'
import { Notifier } from '@server/lib/notifier'
const body: AbuseCreate = req.body
const { id } = await sequelizeTypescript.transaction(async t => {
- const reporterAccount = await AccountModel.load(res.locals.oauth.token.User.Account.id, t)
+ const user = res.locals.oauth.token.User
+ // Don't send abuse notification if reporter is an admin/moderator
+ const skipNotification = user.hasRight(UserRight.MANAGE_ABUSES)
+
+ const reporterAccount = await AccountModel.load(user.Account.id, t)
const predefinedReasons = body.predefinedReasons?.map(r => abusePredefinedReasonsMap[r])
const baseAbuse = {
reporterAccount,
transaction: t,
startAt: body.video.startAt,
- endAt: body.video.endAt
+ endAt: body.video.endAt,
+ skipNotification
})
}
baseAbuse,
commentInstance,
reporterAccount,
- transaction: t
+ transaction: t,
+ skipNotification
})
}
baseAbuse,
accountInstance,
reporterAccount,
- transaction: t
+ transaction: t,
+ skipNotification
})
})