mirror of
https://github.com/HabitRPG/habitica.git
synced 2026-04-26 11:49:19 -05:00
feat(s/s blocker): challenge updates to slack
This commit is contained in:
@@ -234,6 +234,7 @@ api.createChallenge = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// checks public challenge for slurs
|
// checks public challenge for slurs
|
||||||
|
|
||||||
if (group.privacy === 'public'
|
if (group.privacy === 'public'
|
||||||
&& ((textContainsBannedSlur(req.body.name))
|
&& ((textContainsBannedSlur(req.body.name))
|
||||||
|| (textContainsBannedSlur(req.body.shortName))
|
|| (textContainsBannedSlur(req.body.shortName))
|
||||||
@@ -244,6 +245,8 @@ api.createChallenge = {
|
|||||||
slack.sendChallengeSlurNotification({
|
slack.sendChallengeSlurNotification({
|
||||||
authorEmail,
|
authorEmail,
|
||||||
author: user,
|
author: user,
|
||||||
|
uuid: user.id,
|
||||||
|
language: user.preferences.language,
|
||||||
problemContent: [
|
problemContent: [
|
||||||
req.body.name,
|
req.body.name,
|
||||||
req.body.shortName,
|
req.body.shortName,
|
||||||
|
|||||||
@@ -420,13 +420,15 @@ function sendChallengeSlurNotification ({
|
|||||||
if (SKIP_FLAG_METHODS) {
|
if (SKIP_FLAG_METHODS) {
|
||||||
return;
|
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({
|
const authorName = formatUser({
|
||||||
name: author.auth.local.username,
|
name: author.auth.local.username,
|
||||||
displayName: author.profile.name,
|
displayName: author.profile.name,
|
||||||
email: authorEmail,
|
email: authorEmail,
|
||||||
uuid: author.id,
|
language,
|
||||||
|
uuid,
|
||||||
});
|
});
|
||||||
|
|
||||||
flagSlack
|
flagSlack
|
||||||
@@ -435,6 +437,7 @@ function sendChallengeSlurNotification ({
|
|||||||
attachments: [{
|
attachments: [{
|
||||||
fallback: 'Slur Message',
|
fallback: 'Slur Message',
|
||||||
color: 'danger',
|
color: 'danger',
|
||||||
|
title,
|
||||||
author_name: authorName,
|
author_name: authorName,
|
||||||
text: problemContent,
|
text: problemContent,
|
||||||
mrkdwn_in: [
|
mrkdwn_in: [
|
||||||
|
|||||||
Reference in New Issue
Block a user