diff --git a/website/server/controllers/api-v3/challenges.js b/website/server/controllers/api-v3/challenges.js index 9683ad44e7..651def9b51 100644 --- a/website/server/controllers/api-v3/challenges.js +++ b/website/server/controllers/api-v3/challenges.js @@ -234,6 +234,7 @@ api.createChallenge = { }); // checks public challenge for slurs + if (group.privacy === 'public' && ((textContainsBannedSlur(req.body.name)) || (textContainsBannedSlur(req.body.shortName)) @@ -244,6 +245,8 @@ api.createChallenge = { slack.sendChallengeSlurNotification({ authorEmail, author: user, + uuid: user.id, + language: user.preferences.language, problemContent: [ req.body.name, req.body.shortName, diff --git a/website/server/libs/slack.js b/website/server/libs/slack.js index 98fbe7277c..dc4444d16d 100644 --- a/website/server/libs/slack.js +++ b/website/server/libs/slack.js @@ -420,13 +420,15 @@ function sendChallengeSlurNotification ({ if (SKIP_FLAG_METHODS) { return; } - const text = `${author.profile.name} ${authorEmail} (${uuid}, ${language}) tried to post a slur while creating a Challenge.`; + const text = `${author.profile.name} ${authorEmail} (${uuid}, ${language}) tried to create a Challenge with a slur or banned word.`; + const title = 'Challenge Report: Slur/Banned Word'; const authorName = formatUser({ name: author.auth.local.username, displayName: author.profile.name, email: authorEmail, - uuid: author.id, + language, + uuid, }); flagSlack @@ -435,6 +437,7 @@ function sendChallengeSlurNotification ({ attachments: [{ fallback: 'Slur Message', color: 'danger', + title, author_name: authorName, text: problemContent, mrkdwn_in: [