From 9e847c17f968076287025c798b87506a8d50bb93 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 9 Dec 2021 14:27:32 +0100 Subject: No notification on moderator abuse --- server/controllers/api/abuse.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'server/controllers') diff --git a/server/controllers/api/abuse.ts b/server/controllers/api/abuse.ts index 72c418e74..a6d0b0512 100644 --- a/server/controllers/api/abuse.ts +++ b/server/controllers/api/abuse.ts @@ -167,7 +167,11 @@ async function reportAbuse (req: express.Request, res: express.Response) { 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 = { @@ -184,7 +188,8 @@ async function reportAbuse (req: express.Request, res: express.Response) { reporterAccount, transaction: t, startAt: body.video.startAt, - endAt: body.video.endAt + endAt: body.video.endAt, + skipNotification }) } @@ -193,7 +198,8 @@ async function reportAbuse (req: express.Request, res: express.Response) { baseAbuse, commentInstance, reporterAccount, - transaction: t + transaction: t, + skipNotification }) } @@ -202,7 +208,8 @@ async function reportAbuse (req: express.Request, res: express.Response) { baseAbuse, accountInstance, reporterAccount, - transaction: t + transaction: t, + skipNotification }) }) -- cgit v1.2.3