aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/abuse.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/abuse.ts')
-rw-r--r--server/controllers/api/abuse.ts15
1 files changed, 11 insertions, 4 deletions
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) {
167 const body: AbuseCreate = req.body 167 const body: AbuseCreate = req.body
168 168
169 const { id } = await sequelizeTypescript.transaction(async t => { 169 const { id } = await sequelizeTypescript.transaction(async t => {
170 const reporterAccount = await AccountModel.load(res.locals.oauth.token.User.Account.id, t) 170 const user = res.locals.oauth.token.User
171 // Don't send abuse notification if reporter is an admin/moderator
172 const skipNotification = user.hasRight(UserRight.MANAGE_ABUSES)
173
174 const reporterAccount = await AccountModel.load(user.Account.id, t)
171 const predefinedReasons = body.predefinedReasons?.map(r => abusePredefinedReasonsMap[r]) 175 const predefinedReasons = body.predefinedReasons?.map(r => abusePredefinedReasonsMap[r])
172 176
173 const baseAbuse = { 177 const baseAbuse = {
@@ -184,7 +188,8 @@ async function reportAbuse (req: express.Request, res: express.Response) {
184 reporterAccount, 188 reporterAccount,
185 transaction: t, 189 transaction: t,
186 startAt: body.video.startAt, 190 startAt: body.video.startAt,
187 endAt: body.video.endAt 191 endAt: body.video.endAt,
192 skipNotification
188 }) 193 })
189 } 194 }
190 195
@@ -193,7 +198,8 @@ async function reportAbuse (req: express.Request, res: express.Response) {
193 baseAbuse, 198 baseAbuse,
194 commentInstance, 199 commentInstance,
195 reporterAccount, 200 reporterAccount,
196 transaction: t 201 transaction: t,
202 skipNotification
197 }) 203 })
198 } 204 }
199 205
@@ -202,7 +208,8 @@ async function reportAbuse (req: express.Request, res: express.Response) {
202 baseAbuse, 208 baseAbuse,
203 accountInstance, 209 accountInstance,
204 reporterAccount, 210 reporterAccount,
205 transaction: t 211 transaction: t,
212 skipNotification
206 }) 213 })
207 }) 214 })
208 215