habitica/website/server/libs/slack.js

408 lines
10 KiB
JavaScript
Raw Permalink Normal View History

/* eslint-disable camelcase */
import { IncomingWebhook } from '@slack/webhook';
import nconf from 'nconf';
import moment from 'moment';
2019-10-08 14:57:10 +00:00
import logger from './logger';
import { getCurrentEvent } from './worldState'; // eslint-disable-line import/no-cycle
import { TAVERN_ID } from '../models/group'; // eslint-disable-line import/no-cycle
const SLACK_FLAGGING_URL = nconf.get('SLACK_FLAGGING_URL');
const SLACK_FLAGGING_FOOTER_LINK = nconf.get('SLACK_FLAGGING_FOOTER_LINK');
const SLACK_SUBSCRIPTIONS_URL = nconf.get('SLACK_SUBSCRIPTIONS_URL');
const BASE_URL = nconf.get('BASE_URL');
2018-06-02 16:14:53 +00:00
const IS_PRODUCTION = nconf.get('IS_PROD');
const IS_TEST = nconf.get('IS_TEST');
2018-06-02 16:14:53 +00:00
const SKIP_FLAG_METHODS = (IS_PRODUCTION || IS_TEST) && !SLACK_FLAGGING_URL;
const SKIP_SUB_METHOD = (IS_PRODUCTION || IS_TEST) && !SLACK_SUBSCRIPTIONS_URL;
let flagSlack;
let subscriptionSlack;
try {
if ((IS_TEST || IS_PRODUCTION) && SLACK_FLAGGING_URL && SLACK_SUBSCRIPTIONS_URL) {
flagSlack = new IncomingWebhook(SLACK_FLAGGING_URL);
subscriptionSlack = new IncomingWebhook(SLACK_SUBSCRIPTIONS_URL);
} else {
subscriptionSlack = {
// async so that it works like the original Slack send method
async send (data) {
2018-06-02 16:14:53 +00:00
logger.info('Data sent to slack', data);
},
};
flagSlack = subscriptionSlack;
2018-06-02 16:14:53 +00:00
}
} catch (err) {
logger.error(err, 'Error setting up Slack.');
}
/**
*
* @param formatObj.name userName
* @param formatObj.displayName displayName
* @param formatObj.email email
* @param formatObj.uuid uuid
* @returns {string}
*/
function formatUser (formatObj) {
return `@${formatObj.name} ${formatObj.displayName} (${formatObj.email}; ${formatObj.uuid})`;
}
function sendFlagNotification ({
authorEmail,
flagger,
group,
message,
userComment,
automatedComment,
}) {
2018-06-02 16:14:53 +00:00
if (SKIP_FLAG_METHODS) {
return;
}
let titleLink;
let authorName;
let title = `Flag in ${group.name}`;
let text = `${flagger.profile.name} (${flagger.id}; language: ${flagger.preferences.language}) flagged a group message`;
let footer = `<${SLACK_FLAGGING_FOOTER_LINK}?groupId=${group.id}&chatId=${message.id}|Flag this message.>`;
if (userComment) {
text += ` and commented: ${userComment}`;
}
if (automatedComment) {
footer += ` ${automatedComment}`;
}
if (group.id === TAVERN_ID) {
titleLink = `${BASE_URL}/groups/tavern`;
} else if (group.privacy === 'public') {
titleLink = `${BASE_URL}/groups/guild/${group.id}`;
} else {
title += ` - (${group.privacy} ${group.type})`;
}
if (!message.user && message.uuid === 'system') {
authorName = 'System Message';
} else {
authorName = formatUser({
name: message.username,
displayName: message.user,
email: authorEmail,
uuid: message.uuid,
});
}
const timestamp = `${moment(message.timestamp).utc().format('YYYY-MM-DD HH:mm')} UTC`;
flagSlack
.send({
text,
attachments: [{
fallback: 'Flag Message',
color: 'danger',
author_name: `${authorName}\n${timestamp}`,
title,
title_link: titleLink,
text: message.text,
footer,
mrkdwn_in: [
'text',
],
}],
})
.catch(err => logger.error(err, 'Error while sending flag data to Slack.'));
}
function sendInboxFlagNotification ({
messageUserEmail,
flagger,
message,
userComment,
}) {
if (SKIP_FLAG_METHODS) {
return;
}
2019-10-08 14:57:10 +00:00
const titleLink = '';
const title = `Flag in ${flagger.profile.name}'s Inbox`;
let text = `${flagger.profile.name} (${flagger.id}; language: ${flagger.preferences.language}) flagged a PM`;
2019-10-08 14:57:10 +00:00
const footer = '';
if (userComment) {
text += ` and commented: ${userComment}`;
}
2019-10-08 14:57:10 +00:00
const messageText = message.text;
2018-10-10 18:46:43 +00:00
let sender = '';
let recipient = '';
const flaggerFormat = formatUser({
displayName: flagger.profile.name,
name: flagger.auth.local.username,
email: flagger.auth.local.email,
uuid: flagger._id,
});
const messageUserFormat = formatUser({
displayName: message.user,
name: message.username,
email: messageUserEmail,
uuid: message.uuid,
});
2018-10-10 18:46:43 +00:00
if (message.sent) {
sender = flaggerFormat;
recipient = messageUserFormat;
} else {
2018-10-10 18:46:43 +00:00
sender = messageUserFormat;
recipient = flaggerFormat;
}
const authorName = `${sender} wrote this message to ${recipient}.`;
2018-10-10 18:46:43 +00:00
flagSlack
.send({
text,
attachments: [{
fallback: 'Flag Message',
color: 'danger',
author_name: authorName,
title,
title_link: titleLink,
text: messageText,
footer,
mrkdwn_in: [
'text',
],
}],
})
.catch(err => logger.error(err, 'Error while sending flag data to Slack.'));
}
Reporting challenges (#14756) * initial commit * update logic to display flagged challenges properly to users and admins * add report button to pages 'My Challenges' and 'Discover Challenges' * allow mods to view flagged messages on challengeDetail view * update showing flagged challenges for group challenges * update showing flagged challenges for a specific challenge * disallow closing a flagged challenge * update notes to reflect apiParams properly * fix css spacing * update challenge en locales * fix spacing * update title of closeChallengeModal * let user know flagged challenges cannot be cloned * fix linting errors * ensure flagged challenges cannot be declared with a winner and cloned via API * define a non user challenge properly * fix logic to check for a nonParticipant and nonLeader user when grabbing flagged challenges * fix linting of max character of 100 / line * remove reporting on 'my challenges' and 'discover challenges' * WIP(challenges): disable clone button and add notes to new functions * WIP(challenges): smol changes * WIP(challenges): clone button only disabled for admin and flagged user; other users can still clone but the flag goes along with the clone * WIP(challenges): stop flags carrying over on cloned challenges * WIP(challenges): typo fixing, undoing a smol change * fix(challenges): improved query logic for flags * WIP(challenges): more smol changes * fix(challenges): refactor queries * fix(challenges): correct My Challenges tab logic * WIP(challenges): fix clone button state * WIP(challenges): really fixed clone button & clear flags from clones * WIP(challenge): implement new design for reporting modal * WIP(challenge): making things pretty * WIP(challenge): conquering the close button * WIP(challenge): fixin some spacing * WIP(challenge): smol fix * WIP(challenge): making sure the button is actually disabled * WIP(challenge): fix blockquote css * fix(tests): no private guilds * fix(lint): curlies etc * fix(test): moderator permission * fix(lint): sure man whatever * fix(lint): bad vim no tabby * fix(test): permissions not contrib lol * fix(challenges): add icon and fix leaky CSS * fix(challenge): correct clone button behavior --------- Co-authored-by: Julius Jung <me@matchajune.io> Co-authored-by: SabreCat <sabe@habitica.com> Co-authored-by: Sabe Jones <sabrecat@gmail.com>
2023-10-24 14:24:56 +00:00
function sendChallengeFlagNotification ({
flagger,
challenge,
userComment,
}) {
if (SKIP_FLAG_METHODS) {
return;
}
const titleLink = `${BASE_URL}/challenges/${challenge.id}`;
const title = `Flag in challenge "${challenge.name}"`;
let text = `${flagger.profile.name} (${flagger.id}; language: ${flagger.preferences.language}) flagged a challenge`;
const footer = '';
if (userComment) {
text += ` and commented: ${userComment}`;
}
const challengeText = challenge.summary;
flagSlack.send({
text,
attachments: [{
fallback: 'Flag Message',
color: 'danger',
title,
title_link: titleLink,
text: challengeText,
footer,
mrkdwn_in: [
'text',
],
}],
});
}
Squashed commit of the following: commit 3aba0abeddd5136c5312bee9d96a5febd80c0270 Author: SabreCat <sabe@habitica.com> Date: Mon Oct 2 20:51:20 2023 -0500 fix(router): use state to pass modal launch info commit 541eadd319ed48c7bbdbda25e3e5d0780b92e50a Merge: c0bb56c8c2 89fff49d02 Author: SabreCat <sabe@habitica.com> Date: Mon Oct 2 20:12:40 2023 -0500 Merge branch 'release' into report-profile-modal commit c0bb56c8c214203ab7b53790391c81d4833a88bc Author: SabreCat <sabe@habitica.com> Date: Wed Sep 27 16:15:28 2023 -0500 test(profiles): add integrations commit 9b644e9ad8ee09bdb457ad611c7618ced1984fb2 Author: SabreCat <sabe@habitica.com> Date: Tue Sep 26 17:17:22 2023 -0500 fix(profile): adjust margin commit bfefe5dfa9bdfb04b632bca7c9c49c6d36531fa8 Author: SabreCat <sabe@habitica.com> Date: Tue Sep 26 17:12:24 2023 -0500 fix(profiles): moar layout fixes commit 8f211ee3e2f7decf9426004ae5feb031a3d34fca Author: SabreCat <sabe@habitica.com> Date: Mon Sep 25 17:32:04 2023 -0500 fix(profile): fix admin actions Correct "user is banned" banner Fix bouncing modal Add "Days" smart plural Fix leaky CSS on Market page Refactor some redundant functions commit b1d23ec88b5414187d1f0220efa54410f92286b1 Merge: ee9709a9e1 a63cc84779 Author: SabreCat <sabe@habitica.com> Date: Mon Sep 25 15:37:54 2023 -0500 Merge branch 'release' into report-profile-modal commit ee9709a9e1499cbea5983543103bba62c4a82103 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Sep 18 16:30:30 2023 -0400 WIP(profile): add banned banner, toggle switches now toggle, add "days" to Next Login Reward commit f80928a8956d6db34b89dc203a43e471eef8fa51 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Sep 18 13:43:34 2023 -0400 update(node): update node modules commit 1d552f7e80735a0759cbc4777b49c7c552cd200d Author: SabreCat <sabe@habitica.com> Date: Fri Sep 15 16:52:22 2023 -0500 fix(import): remove empty import commit f55d74a95dcf7e8b2210be6e1a7f661389863ee6 Author: SabreCat <sabe@habitica.com> Date: Fri Sep 15 16:39:50 2023 -0500 refactor(profiles): remove email feature also still more visual cleanup of profile modal commit 311c74328440c99f05bc3b342ce1250838eca826 Author: SabreCat <sabe@habitica.com> Date: Fri Sep 15 15:44:56 2023 -0500 refactor(profile): remove page view commit f8632bf50d54008cca368e8bf7b4b302cc4367bf Merge: ec85159c65 9e25360102 Author: SabreCat <sabe@habitica.com> Date: Fri Sep 15 15:23:21 2023 -0500 Merge branch 'release' into report-profile-modal commit ec85159c65ed3a8b687713b54666dfb18b6cc93b Author: SabreCat <sabe@habitica.com> Date: Mon Sep 11 22:53:14 2023 -0500 feat(profiles): load modal instead of page? commit 99860829142e377a98775fb50a007ff7e7e301d0 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 8 14:49:57 2023 -0400 WIP(profile): fixed a comment, woohoo commit 6262a9ba0ca270eadc3c1a330a9917a4fd35cfa9 Merge: ae2b614df2 ea2b007b1a Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 8 13:40:23 2023 -0400 Merge remote-tracking branch 'origin/report-profile-modal' into report-profile-modal commit ea2b007b1a5459343dbf4dd49531768fbb8cad38 Author: SabreCat <sabe@habitica.com> Date: Thu Sep 7 16:54:19 2023 -0500 fix(profile): focus behavior commit ae2b614df20493c993bc830f41e671eae10d5297 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Sep 7 17:47:08 2023 -0400 WIP(profile): styling updates commit 2e0723f1b94595bd6a6d816abf9bf137f7241c75 Author: SabreCat <sabe@habitica.com> Date: Thu Sep 7 15:37:59 2023 -0500 feat(moderation): unflag profile Also a few stylistic tweaks commit edcf8113deb29e7d8540130f096717c9278b02fd Author: SabreCat <sabe@habitica.com> Date: Wed Sep 6 16:39:02 2023 -0500 WIP(profile): dropdown draft commit 0691483d63c9aa2a844c77034ad4215477c05ee4 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Sep 6 16:33:30 2023 -0400 WIP(profile): Styling and string updates commit 7e9d57d10a4aebbd373982a24da7108515352e15 Author: SabreCat <sabe@habitica.com> Date: Wed Sep 6 11:40:31 2023 -0500 feat(profile): functional dropdown buttons commit a2989b28330679d3f14198e3835f35079eb4e282 Merge: af6575e40c e072d7c09c Author: SabreCat <sabe@habitica.com> Date: Wed Sep 6 10:04:57 2023 -0500 Merge branch 'release' into report-profile-modal commit af6575e40cb2d78c813568f7bb690590d2ad754f Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Sep 6 11:01:05 2023 -0400 WIP(profile): comment cleanup commit 7b1de37202daea29c8c95e38dac9ff974b70ea8d Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Sep 5 17:22:14 2023 -0400 WIP(profile): remove shadowban tooltip commit d1177c32b9c012d838448b29601a6970bcb4e927 Merge: 321a01b081 31f821021b Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Sep 5 17:02:40 2023 -0400 Merge branch 'sabrecat/report-profile' into report-profile-modal commit 321a01b08120c6214793fcff14c09d011520e5a0 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 1 16:14:36 2023 -0400 WIP(profile): close button finally workinating commit e143d36d28f8a0e46d41931da021bacbae9649dc Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 1 15:52:38 2023 -0400 WIP(profile): close icon moved to profile.vue commit 31f821021b11de4c320d19ee6aadca845fc8afed Merge: a8f5e25d38 8957c5c009 Author: SabreCat <sabe@habitica.com> Date: Fri Sep 1 14:52:31 2023 -0500 Merge branch 'report-profile-modal' into sabrecat/report-profile commit 8957c5c009dac11a4a8c1292c603d101ca9ff216 Merge: d340f06a22 0aec3866a4 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 1 15:38:12 2023 -0400 Merge remote-tracking branch 'origin/report-profile-modal' into report-profile-modal commit d340f06a22691a929c87b464560c4d8b4046b0d6 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 1 15:37:57 2023 -0400 WIP(profile): fixed user not found error commit 0aec3866a49a991a869cf13d33592ff80347306e Merge: b01f323b14 ac7c8e0eb6 Author: Natalie <78037386+CuriousMagpie@users.noreply.github.com> Date: Fri Sep 1 15:28:58 2023 -0400 Merge branch 'HabitRPG:develop' into report-profile-modal commit a8f5e25d38493d41b2f64f9abfe9cf754fd15481 Author: SabreCat <sabe@habitica.com> Date: Thu Aug 31 17:02:07 2023 -0500 feat(community): basic "report profile" commit b01f323b148aa46dc6371f3234e4912d50551a3a Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Aug 31 17:42:12 2023 -0400 WIP(profile): removed refactoring crud, located where close icon should be (profileModal.vue) commit ce7d51a20cdbeb4a32e750205759dbd748d95ccd Merge: 010f2299f0 ac7c8e0eb6 Author: SabreCat <sabe@habitica.com> Date: Thu Aug 31 14:20:37 2023 -0500 Merge branch 'release' into sabrecat/report-profile commit 18b41acd9440a9a2574d4d8a6056f740e7d00730 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Aug 31 12:23:41 2023 -0400 WIP(profile): moar buttonz commit 9387b3a6bc35a937f9558e3395e2eb291fd11f72 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 30 17:21:36 2023 -0400 WIP(profile): buttons commit b3ea48c4f5b30747b1b28d159818c05341994bb4 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Aug 25 15:52:41 2023 -0400 WIP(profile): work on achievement component commit a1ceb2ea7560e5bec9c1b6a7f7113db466855381 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Aug 25 14:39:12 2023 -0400 WIP(profile): create achievements component commit 4a24d9b80b434e752fcd22098691a05e80aa8fb1 Merge: 8fe263a377 1e05297e96 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 23 13:14:39 2023 -0400 Merge branch 'develop' into report-profile-modal commit 1e05297e96b0e9b25c7713dc8fee5c18dc9c27b8 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 23 13:12:52 2023 -0400 package updates commit 8fe263a377ffdfb59b667c0c2da9aa88924db78a Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 23 12:12:36 2023 -0400 update(dependencies): ran npm install to update dependencies commit 190fe048a11395d9cde11c6682fd3b9d06d9abbc Merge: 3ea48ab5cb fa83d1a9cf Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 23 11:52:08 2023 -0400 Merge branch 'develop' into report-profile-modal commit 3ea48ab5cb80b9eccbce82bdce01901b02a5c36e Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Aug 11 17:12:31 2023 -0400 WIP(user profile): dropdown menu and toggles and colors oh my commit c301a2b46025efa2a7fb33edac79be7e1bb467f3 Merge: 1da6af11b5 647b27c55f Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Aug 11 12:40:07 2023 -0400 Merge branch 'develop' into report-profile-modal commit 1da6af11b597bbbd2abba2d99007a32ff520d954 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Aug 10 16:50:07 2023 -0400 WIP(user profile): moved some CSS classes out of unscoped and into the scoped section, started on toggle buttons commit dd55cbc928b9a89c2c800d6e5e46e09aaf655ba4 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 9 15:38:46 2023 -0400 WIP(user profile): workin on the hamburger (kebab?) menu commit 3834093207443364e5f5906ce0a522f29c1a9924 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Aug 8 14:14:40 2023 -0400 WIP(user profiles): working on the drop down menu commit f2be5881950271cbeb67c7101054c8c3721d7f81 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Aug 7 16:10:30 2023 -0400 WIP(user profile): options menu commit 010f2299f0c0f2a6537c0989be039e8fa17a366b Author: SabreCat <sabe@habitica.com> Date: Mon Aug 7 11:49:04 2023 -0500 fix(lint): eof and const commit 4551dbf4b3f8def55480ac60224d2a4fbebbb4f2 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Aug 4 15:34:05 2023 -0400 WIP(user profile): styling the top portion of the modal commit 19a9fe36447646d56ea1d614cd75bff5f5328f61 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Aug 3 15:06:51 2023 -0400 WIP(user profile): adding buttons commit dfdb305b1c6eb3b455b386f5c19f603540e16644 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 2 14:41:20 2023 -0400 WIP(user profile): layout commit ded4eee6934a3085ac5b8c06d24d4fe3dbfb18ba Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 2 12:04:02 2023 -0400 WIP(user profile): start flex grid & tidy up CSS commit aaca48be3214a9f33fc03d0cc028f694a4fa8cb0 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Jul 28 16:44:06 2023 -0400 WIP(user profile): mostly css updates commit e531985b8718b43339d11668c77109e1e52f7264 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Jul 27 16:49:44 2023 -0400 WIP(user profile): one infinitesimal change that's hardly worth the electricity it's made from commit eb4021fcc7e8b6bed195b9f337b95467e30cf0c6 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Jul 26 16:33:05 2023 -0400 feat(content): upgrade profile page commit 1b25394f3e5a7db92d4887edcc78bda0bff25508 Merge: c50cee0d88 8558dcc3a8 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Jul 26 11:50:12 2023 -0400 Merge branch 'develop' into report-profile-modal commit c50cee0d88b9ef1b52513f164f1c4824aef22405 Author: SabreCat <sabe@habitica.com> Date: Wed Jul 12 16:32:25 2023 -0500 fix(flagging): debug params issue Also add and document the "source" body param commit 55848c58bead479fdb687bb9a2e2b2a649a557e9 Author: SabreCat <sabe@habitica.com> Date: Mon Jul 10 16:24:20 2023 -0500 WIP(members): basic report a user API commit dda61807922655515e0fc9bbc075bd6f51491b9c Author: SabreCat <sabe@habitica.com> Date: Thu Jul 6 10:05:07 2023 -0500 fix(lint): remove console.info
2023-10-03 18:29:26 +00:00
function sendProfileFlagNotification ({
reporter,
flaggedUser,
userComment,
source,
}) {
const title = 'User Profile Report';
const titleLink = `${BASE_URL}/profile/${flaggedUser._id}`;
let text = `@${reporter.auth.local.username} (${reporter._id}; language: ${reporter.preferences.language}) flagged @${flaggedUser.auth.local.username}'s profile from ${source}`;
if (userComment) {
text += ` and commented: ${userComment}`;
}
let profileData = `Display Name: ${flaggedUser.profile.name}`;
if (flaggedUser.profile.imageUrl) {
profileData += `\n\nImage URL: ${flaggedUser.profile.imageUrl}`;
}
if (flaggedUser.profile.blurb) {
profileData += `\n\nAbout: ${flaggedUser.profile.blurb}`;
}
flagSlack
.send({
text,
attachments: [{
fallback: 'Flag Profile',
color: 'danger',
title,
title_link: titleLink,
text: profileData,
mrkdwn_in: [
'text',
],
}],
})
.catch(err => logger.error(err, 'Error while sending flag data to Slack.'));
}
function sendSubscriptionNotification ({
buyer,
recipient,
paymentMethod,
months,
groupId,
autoRenews,
}) {
2018-06-02 16:14:53 +00:00
if (SKIP_SUB_METHOD) {
return;
}
let text;
2019-10-08 14:57:10 +00:00
const timestamp = new Date();
2017-01-07 15:42:03 +00:00
if (recipient.id) {
const currentEvent = getCurrentEvent();
const promoString = currentEvent && currentEvent.promo ? ' and got a promo' : '';
text = `${buyer.name} ${buyer.id} ${buyer.email} bought a ${months}-month gift subscription for ${recipient.name} ${recipient.id} ${recipient.email}${promoString} using ${paymentMethod} on ${timestamp}`;
} else if (groupId) {
text = `${buyer.name} ${buyer.id} ${buyer.email} bought a 1-month recurring group-plan for ${groupId} using ${paymentMethod} on ${timestamp}`;
} else if (autoRenews) {
2017-01-07 15:42:03 +00:00
text = `${buyer.name} ${buyer.id} ${buyer.email} bought a ${months}-month recurring subscription using ${paymentMethod} on ${timestamp}`;
} else {
text = `${buyer.name} ${buyer.id} ${buyer.email} bought a ${months}-month non-recurring subscription using ${paymentMethod} on ${timestamp}`;
}
subscriptionSlack
.send({
text,
})
.catch(err => logger.error(err, 'Error while sending subscription data to Slack.'));
}
function sendShadowMutedPostNotification ({
authorEmail,
author,
group,
message,
}) {
if (SKIP_FLAG_METHODS) {
return;
}
2019-10-08 14:57:10 +00:00
const title = `Shadow-Muted Post in ${group.name}`;
const text = `@${author.auth.local.username} / ${author.profile.name} posted while shadow-muted`;
let titleLink;
if (group.id === TAVERN_ID) {
titleLink = `${BASE_URL}/groups/tavern`;
} else {
titleLink = `${BASE_URL}/groups/guild/${group.id}`;
}
const authorName = formatUser({
name: author.auth.local.username,
displayName: author.profile.name,
email: authorEmail,
uuid: author.id,
});
flagSlack
.send({
text,
attachments: [{
fallback: 'Shadow-Muted Message',
color: 'danger',
author_name: authorName,
title,
title_link: titleLink,
text: message,
mrkdwn_in: [
'text',
],
}],
})
.catch(err => logger.error(err, 'Error while sending flag data to Slack.'));
}
Squashed commit of the following: commit 83bcd07e20385d58f69f9490bf168307e454b2cc Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 17:24:45 2023 -0600 fix(profile): revert state on error commit 6aa6278727eb22c6133994f648ef0df3b0e7e866 Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 14:37:28 2023 -0600 fix(test): no longer care about swears in profile commit 0882c77038f43fdd237e8f75d52bef256fa97d42 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:15:42 2023 -0600 fix(lint): remove unused functions commit 9b275ef72d5315eb1ccd50c44a349d5b7d902bd3 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:09:11 2023 -0600 fix(profiles): restore reporting functionality Also remove unused and/or unrelated code and clean up comments commit f4ed8c14619456aa264543cd077f73db3fc374b8 Merge: da16aa9c75 f8ba191eea Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 12:11:00 2023 -0600 Merge branch 'release' into slur-swear-blocker commit da16aa9c75afefe2929e25bca0d47720cb1dd16a Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 21 13:20:28 2023 -0500 feat(s/s blocker): challenge updates to slack commit 51bed61c4c21241d5f0af1729cd9065e80a334cd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 19 15:36:59 2023 -0500 feat(s/s blocker): work on challenges commit 139cbcb21c47c86c760722c876358c2b6372e72f Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 13 13:20:45 2023 -0500 fix(slack): update Slack notification to include authorEmail and remove undefined commit 805b287721ede4a3a3a9f950afceebe55caf7d23 Author: SabreCat <sabe@habitica.com> Date: Tue Dec 12 16:35:54 2023 -0600 fix(profiles): improve profanity check logic commit 02ef7e8822a8b9e2680423fdebf5f03a2c51262f Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 17:22:29 2023 -0500 feat(slur blocker): arghhhhhh commit 949dee9b1ef659ee285fc603d30d4bdd48894ffd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 13:57:29 2023 -0500 feat(slur blocker): more refactoring commit bf953998f41ae7f2e7a25465321430f181f09769 Merge: d21aa687b7 f572aa442e Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 11 15:20:06 2023 -0500 Merge branch 'release' into slur-swear-blocker commit d21aa687b7b493a06a4079cf0b2ef90ad6565138 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 7 18:00:29 2023 -0500 feat(slur blocker): refactoring code commit f2db90c494b6c2705721e1b9fdbf503aec7ad7d8 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 6 12:12:55 2023 -0500 feat(slur/swear blocker): work on Profiles commit 8f9822ffe8c820918f1ff59c3fd97faded9ad1f9 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 4 17:25:17 2023 -0500 feat(profiles/challenges): work on profile block & slack report commit bdb2e06e5e4fc9c34c0abc27139737be05d1320b Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 16:11:27 2023 -0500 feat(slur/swear): working on it commit 7277b5cad5ceb17c97fda22d871bf3e2edd104b7 Merge: 24d14277ab 941f1f976c Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 15:04:46 2023 -0500 Merge branch 'profile-slur-swear-blocker' into slur-swear-blocker commit 941f1f976c8a04f22a6843e70caea9e071e409b3 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 30 14:34:30 2023 -0500 feat(profiles/PMs): slur/swear blocker upgrade commit 0863017efc0f7a1832a296addabe68ba16278cf6 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 28 16:21:21 2023 -0500 feat(profiles): slur/swear blocker commit e9937d864ff35e9ac70c4c3c58d172187cdb3c3f Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 15:24:37 2023 -0500 feat(profiles): slur/swear blocker commit 24d14277ab84f7fb3c67aa666ef8ae4312c68cb5 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 14:12:46 2023 -0500 feat(challenges): update behavior based on public/private groups commit 1251f5b6a7ccc57f76b9979dc57c5dc3c712520e Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 16:28:29 2023 -0500 feat(challenges): swear and slur blocker commit a771045ca7dde5bd4edea83dcb5572e093da95f1 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 15:46:16 2023 -0500 feat(challenges): even more slur blocker commit e5e91aa78ad244a55e6f43f35bef5ef7b3254d9b Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 14:31:25 2023 -0500 feat(challenges): more slur blocker commit 50e824e4e3ebf1479deb17fd0ecf6d293c56db62 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 13 15:12:14 2023 -0500 feat(challenges): slur blocker commit 315ea24ef4ab846ddcc8a20ea09a58c6eb523a24 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Nov 3 12:31:12 2023 -0400 feat(challenges): slur blocker work commit 0f742d219fd5bcbb47b29e3c80d73284688490a7 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 2 16:22:31 2023 -0400 feat(challenges): add banned words & slur blocker to challenges commit 40d6b60ee3c8675b95646132d85f47b44a0bdbb4 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Oct 23 13:00:46 2023 -0400 update packages on local/origin repo
2024-01-10 21:14:11 +00:00
// slack slur notification for Profiles
function sendProfileSlurNotification ({
Automatically mute users who attempt to post a slur, fixes #8062 (#8177) * Initial psuedo-code for checking for slurs in messages * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Fixing rebase * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * First attempt at the muteUser function: revokes user's chat privileges and notifies moderators * Manual merge for cherry-pick * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Created report to be sent to moderators via email * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * Removed some code that got re-added after rebase * Tests for automatic slur muting pass but are incomplete (do not check that chatRevoked flag is true) * Moved list of banned slurs to server side * Added warning to bannedSlurs file * Test chat privileges revoked when posting slur in public chat * Fix issues left over after rebase (I hope) * Added code to test for revoked chat privileges after posting a slur in a private group * Moved banned slur message into locales message * Added new code to check for banned slurs (parallels banned words code) * Fixed AUTHOR_MOTAL_URL in sendTxn for slur blocking * Added tests that email sent on attempted slur in chat post * Created context for slur-related-tests, fixed sandboxing of email. Successfully tests that email.sendTxn is called, but the email content test fails * commented out slack (for now) and cleaned up tests of sending email * Successfully tests that slur-report-to-mods email is sent * Slack message is sent, and testing works, but some user variables seem to only work when found in chat.js and passed to slack * Made some fixes for lint, but not sure what to do about the camel case requirement fail, since that's how they're defined in other slack calls * Slack tests pass, skipped camelcase check around those code blocks * Fixed InternalServerError caused by slack messaging * Updated chat privileges revoked error * fix(locale): typo correction
2017-07-19 21:06:15 +00:00
authorEmail,
author,
Squashed commit of the following: commit 83bcd07e20385d58f69f9490bf168307e454b2cc Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 17:24:45 2023 -0600 fix(profile): revert state on error commit 6aa6278727eb22c6133994f648ef0df3b0e7e866 Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 14:37:28 2023 -0600 fix(test): no longer care about swears in profile commit 0882c77038f43fdd237e8f75d52bef256fa97d42 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:15:42 2023 -0600 fix(lint): remove unused functions commit 9b275ef72d5315eb1ccd50c44a349d5b7d902bd3 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:09:11 2023 -0600 fix(profiles): restore reporting functionality Also remove unused and/or unrelated code and clean up comments commit f4ed8c14619456aa264543cd077f73db3fc374b8 Merge: da16aa9c75 f8ba191eea Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 12:11:00 2023 -0600 Merge branch 'release' into slur-swear-blocker commit da16aa9c75afefe2929e25bca0d47720cb1dd16a Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 21 13:20:28 2023 -0500 feat(s/s blocker): challenge updates to slack commit 51bed61c4c21241d5f0af1729cd9065e80a334cd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 19 15:36:59 2023 -0500 feat(s/s blocker): work on challenges commit 139cbcb21c47c86c760722c876358c2b6372e72f Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 13 13:20:45 2023 -0500 fix(slack): update Slack notification to include authorEmail and remove undefined commit 805b287721ede4a3a3a9f950afceebe55caf7d23 Author: SabreCat <sabe@habitica.com> Date: Tue Dec 12 16:35:54 2023 -0600 fix(profiles): improve profanity check logic commit 02ef7e8822a8b9e2680423fdebf5f03a2c51262f Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 17:22:29 2023 -0500 feat(slur blocker): arghhhhhh commit 949dee9b1ef659ee285fc603d30d4bdd48894ffd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 13:57:29 2023 -0500 feat(slur blocker): more refactoring commit bf953998f41ae7f2e7a25465321430f181f09769 Merge: d21aa687b7 f572aa442e Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 11 15:20:06 2023 -0500 Merge branch 'release' into slur-swear-blocker commit d21aa687b7b493a06a4079cf0b2ef90ad6565138 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 7 18:00:29 2023 -0500 feat(slur blocker): refactoring code commit f2db90c494b6c2705721e1b9fdbf503aec7ad7d8 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 6 12:12:55 2023 -0500 feat(slur/swear blocker): work on Profiles commit 8f9822ffe8c820918f1ff59c3fd97faded9ad1f9 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 4 17:25:17 2023 -0500 feat(profiles/challenges): work on profile block & slack report commit bdb2e06e5e4fc9c34c0abc27139737be05d1320b Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 16:11:27 2023 -0500 feat(slur/swear): working on it commit 7277b5cad5ceb17c97fda22d871bf3e2edd104b7 Merge: 24d14277ab 941f1f976c Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 15:04:46 2023 -0500 Merge branch 'profile-slur-swear-blocker' into slur-swear-blocker commit 941f1f976c8a04f22a6843e70caea9e071e409b3 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 30 14:34:30 2023 -0500 feat(profiles/PMs): slur/swear blocker upgrade commit 0863017efc0f7a1832a296addabe68ba16278cf6 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 28 16:21:21 2023 -0500 feat(profiles): slur/swear blocker commit e9937d864ff35e9ac70c4c3c58d172187cdb3c3f Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 15:24:37 2023 -0500 feat(profiles): slur/swear blocker commit 24d14277ab84f7fb3c67aa666ef8ae4312c68cb5 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 14:12:46 2023 -0500 feat(challenges): update behavior based on public/private groups commit 1251f5b6a7ccc57f76b9979dc57c5dc3c712520e Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 16:28:29 2023 -0500 feat(challenges): swear and slur blocker commit a771045ca7dde5bd4edea83dcb5572e093da95f1 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 15:46:16 2023 -0500 feat(challenges): even more slur blocker commit e5e91aa78ad244a55e6f43f35bef5ef7b3254d9b Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 14:31:25 2023 -0500 feat(challenges): more slur blocker commit 50e824e4e3ebf1479deb17fd0ecf6d293c56db62 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 13 15:12:14 2023 -0500 feat(challenges): slur blocker commit 315ea24ef4ab846ddcc8a20ea09a58c6eb523a24 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Nov 3 12:31:12 2023 -0400 feat(challenges): slur blocker work commit 0f742d219fd5bcbb47b29e3c80d73284688490a7 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 2 16:22:31 2023 -0400 feat(challenges): add banned words & slur blocker to challenges commit 40d6b60ee3c8675b95646132d85f47b44a0bdbb4 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Oct 23 13:00:46 2023 -0400 update packages on local/origin repo
2024-01-10 21:14:11 +00:00
uuid,
language,
problemContent,
Automatically mute users who attempt to post a slur, fixes #8062 (#8177) * Initial psuedo-code for checking for slurs in messages * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Fixing rebase * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * First attempt at the muteUser function: revokes user's chat privileges and notifies moderators * Manual merge for cherry-pick * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Created report to be sent to moderators via email * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * Removed some code that got re-added after rebase * Tests for automatic slur muting pass but are incomplete (do not check that chatRevoked flag is true) * Moved list of banned slurs to server side * Added warning to bannedSlurs file * Test chat privileges revoked when posting slur in public chat * Fix issues left over after rebase (I hope) * Added code to test for revoked chat privileges after posting a slur in a private group * Moved banned slur message into locales message * Added new code to check for banned slurs (parallels banned words code) * Fixed AUTHOR_MOTAL_URL in sendTxn for slur blocking * Added tests that email sent on attempted slur in chat post * Created context for slur-related-tests, fixed sandboxing of email. Successfully tests that email.sendTxn is called, but the email content test fails * commented out slack (for now) and cleaned up tests of sending email * Successfully tests that slur-report-to-mods email is sent * Slack message is sent, and testing works, but some user variables seem to only work when found in chat.js and passed to slack * Made some fixes for lint, but not sure what to do about the camel case requirement fail, since that's how they're defined in other slack calls * Slack tests pass, skipped camelcase check around those code blocks * Fixed InternalServerError caused by slack messaging * Updated chat privileges revoked error * fix(locale): typo correction
2017-07-19 21:06:15 +00:00
}) {
2018-06-02 16:14:53 +00:00
if (SKIP_FLAG_METHODS) {
Automatically mute users who attempt to post a slur, fixes #8062 (#8177) * Initial psuedo-code for checking for slurs in messages * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Fixing rebase * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * First attempt at the muteUser function: revokes user's chat privileges and notifies moderators * Manual merge for cherry-pick * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Created report to be sent to moderators via email * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * Removed some code that got re-added after rebase * Tests for automatic slur muting pass but are incomplete (do not check that chatRevoked flag is true) * Moved list of banned slurs to server side * Added warning to bannedSlurs file * Test chat privileges revoked when posting slur in public chat * Fix issues left over after rebase (I hope) * Added code to test for revoked chat privileges after posting a slur in a private group * Moved banned slur message into locales message * Added new code to check for banned slurs (parallels banned words code) * Fixed AUTHOR_MOTAL_URL in sendTxn for slur blocking * Added tests that email sent on attempted slur in chat post * Created context for slur-related-tests, fixed sandboxing of email. Successfully tests that email.sendTxn is called, but the email content test fails * commented out slack (for now) and cleaned up tests of sending email * Successfully tests that slur-report-to-mods email is sent * Slack message is sent, and testing works, but some user variables seem to only work when found in chat.js and passed to slack * Made some fixes for lint, but not sure what to do about the camel case requirement fail, since that's how they're defined in other slack calls * Slack tests pass, skipped camelcase check around those code blocks * Fixed InternalServerError caused by slack messaging * Updated chat privileges revoked error * fix(locale): typo correction
2017-07-19 21:06:15 +00:00
return;
}
Squashed commit of the following: commit 83bcd07e20385d58f69f9490bf168307e454b2cc Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 17:24:45 2023 -0600 fix(profile): revert state on error commit 6aa6278727eb22c6133994f648ef0df3b0e7e866 Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 14:37:28 2023 -0600 fix(test): no longer care about swears in profile commit 0882c77038f43fdd237e8f75d52bef256fa97d42 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:15:42 2023 -0600 fix(lint): remove unused functions commit 9b275ef72d5315eb1ccd50c44a349d5b7d902bd3 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:09:11 2023 -0600 fix(profiles): restore reporting functionality Also remove unused and/or unrelated code and clean up comments commit f4ed8c14619456aa264543cd077f73db3fc374b8 Merge: da16aa9c75 f8ba191eea Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 12:11:00 2023 -0600 Merge branch 'release' into slur-swear-blocker commit da16aa9c75afefe2929e25bca0d47720cb1dd16a Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 21 13:20:28 2023 -0500 feat(s/s blocker): challenge updates to slack commit 51bed61c4c21241d5f0af1729cd9065e80a334cd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 19 15:36:59 2023 -0500 feat(s/s blocker): work on challenges commit 139cbcb21c47c86c760722c876358c2b6372e72f Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 13 13:20:45 2023 -0500 fix(slack): update Slack notification to include authorEmail and remove undefined commit 805b287721ede4a3a3a9f950afceebe55caf7d23 Author: SabreCat <sabe@habitica.com> Date: Tue Dec 12 16:35:54 2023 -0600 fix(profiles): improve profanity check logic commit 02ef7e8822a8b9e2680423fdebf5f03a2c51262f Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 17:22:29 2023 -0500 feat(slur blocker): arghhhhhh commit 949dee9b1ef659ee285fc603d30d4bdd48894ffd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 13:57:29 2023 -0500 feat(slur blocker): more refactoring commit bf953998f41ae7f2e7a25465321430f181f09769 Merge: d21aa687b7 f572aa442e Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 11 15:20:06 2023 -0500 Merge branch 'release' into slur-swear-blocker commit d21aa687b7b493a06a4079cf0b2ef90ad6565138 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 7 18:00:29 2023 -0500 feat(slur blocker): refactoring code commit f2db90c494b6c2705721e1b9fdbf503aec7ad7d8 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 6 12:12:55 2023 -0500 feat(slur/swear blocker): work on Profiles commit 8f9822ffe8c820918f1ff59c3fd97faded9ad1f9 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 4 17:25:17 2023 -0500 feat(profiles/challenges): work on profile block & slack report commit bdb2e06e5e4fc9c34c0abc27139737be05d1320b Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 16:11:27 2023 -0500 feat(slur/swear): working on it commit 7277b5cad5ceb17c97fda22d871bf3e2edd104b7 Merge: 24d14277ab 941f1f976c Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 15:04:46 2023 -0500 Merge branch 'profile-slur-swear-blocker' into slur-swear-blocker commit 941f1f976c8a04f22a6843e70caea9e071e409b3 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 30 14:34:30 2023 -0500 feat(profiles/PMs): slur/swear blocker upgrade commit 0863017efc0f7a1832a296addabe68ba16278cf6 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 28 16:21:21 2023 -0500 feat(profiles): slur/swear blocker commit e9937d864ff35e9ac70c4c3c58d172187cdb3c3f Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 15:24:37 2023 -0500 feat(profiles): slur/swear blocker commit 24d14277ab84f7fb3c67aa666ef8ae4312c68cb5 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 14:12:46 2023 -0500 feat(challenges): update behavior based on public/private groups commit 1251f5b6a7ccc57f76b9979dc57c5dc3c712520e Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 16:28:29 2023 -0500 feat(challenges): swear and slur blocker commit a771045ca7dde5bd4edea83dcb5572e093da95f1 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 15:46:16 2023 -0500 feat(challenges): even more slur blocker commit e5e91aa78ad244a55e6f43f35bef5ef7b3254d9b Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 14:31:25 2023 -0500 feat(challenges): more slur blocker commit 50e824e4e3ebf1479deb17fd0ecf6d293c56db62 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 13 15:12:14 2023 -0500 feat(challenges): slur blocker commit 315ea24ef4ab846ddcc8a20ea09a58c6eb523a24 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Nov 3 12:31:12 2023 -0400 feat(challenges): slur blocker work commit 0f742d219fd5bcbb47b29e3c80d73284688490a7 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 2 16:22:31 2023 -0400 feat(challenges): add banned words & slur blocker to challenges commit 40d6b60ee3c8675b95646132d85f47b44a0bdbb4 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Oct 23 13:00:46 2023 -0400 update packages on local/origin repo
2024-01-10 21:14:11 +00:00
const title = 'User Profile Report: Slur';
const titleLink = `${BASE_URL}/profile/${uuid}`;
Automatically mute users who attempt to post a slur, fixes #8062 (#8177) * Initial psuedo-code for checking for slurs in messages * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Fixing rebase * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * First attempt at the muteUser function: revokes user's chat privileges and notifies moderators * Manual merge for cherry-pick * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Created report to be sent to moderators via email * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * Removed some code that got re-added after rebase * Tests for automatic slur muting pass but are incomplete (do not check that chatRevoked flag is true) * Moved list of banned slurs to server side * Added warning to bannedSlurs file * Test chat privileges revoked when posting slur in public chat * Fix issues left over after rebase (I hope) * Added code to test for revoked chat privileges after posting a slur in a private group * Moved banned slur message into locales message * Added new code to check for banned slurs (parallels banned words code) * Fixed AUTHOR_MOTAL_URL in sendTxn for slur blocking * Added tests that email sent on attempted slur in chat post * Created context for slur-related-tests, fixed sandboxing of email. Successfully tests that email.sendTxn is called, but the email content test fails * commented out slack (for now) and cleaned up tests of sending email * Successfully tests that slur-report-to-mods email is sent * Slack message is sent, and testing works, but some user variables seem to only work when found in chat.js and passed to slack * Made some fixes for lint, but not sure what to do about the camel case requirement fail, since that's how they're defined in other slack calls * Slack tests pass, skipped camelcase check around those code blocks * Fixed InternalServerError caused by slack messaging * Updated chat privileges revoked error * fix(locale): typo correction
2017-07-19 21:06:15 +00:00
Squashed commit of the following: commit 83bcd07e20385d58f69f9490bf168307e454b2cc Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 17:24:45 2023 -0600 fix(profile): revert state on error commit 6aa6278727eb22c6133994f648ef0df3b0e7e866 Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 14:37:28 2023 -0600 fix(test): no longer care about swears in profile commit 0882c77038f43fdd237e8f75d52bef256fa97d42 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:15:42 2023 -0600 fix(lint): remove unused functions commit 9b275ef72d5315eb1ccd50c44a349d5b7d902bd3 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:09:11 2023 -0600 fix(profiles): restore reporting functionality Also remove unused and/or unrelated code and clean up comments commit f4ed8c14619456aa264543cd077f73db3fc374b8 Merge: da16aa9c75 f8ba191eea Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 12:11:00 2023 -0600 Merge branch 'release' into slur-swear-blocker commit da16aa9c75afefe2929e25bca0d47720cb1dd16a Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 21 13:20:28 2023 -0500 feat(s/s blocker): challenge updates to slack commit 51bed61c4c21241d5f0af1729cd9065e80a334cd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 19 15:36:59 2023 -0500 feat(s/s blocker): work on challenges commit 139cbcb21c47c86c760722c876358c2b6372e72f Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 13 13:20:45 2023 -0500 fix(slack): update Slack notification to include authorEmail and remove undefined commit 805b287721ede4a3a3a9f950afceebe55caf7d23 Author: SabreCat <sabe@habitica.com> Date: Tue Dec 12 16:35:54 2023 -0600 fix(profiles): improve profanity check logic commit 02ef7e8822a8b9e2680423fdebf5f03a2c51262f Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 17:22:29 2023 -0500 feat(slur blocker): arghhhhhh commit 949dee9b1ef659ee285fc603d30d4bdd48894ffd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 13:57:29 2023 -0500 feat(slur blocker): more refactoring commit bf953998f41ae7f2e7a25465321430f181f09769 Merge: d21aa687b7 f572aa442e Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 11 15:20:06 2023 -0500 Merge branch 'release' into slur-swear-blocker commit d21aa687b7b493a06a4079cf0b2ef90ad6565138 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 7 18:00:29 2023 -0500 feat(slur blocker): refactoring code commit f2db90c494b6c2705721e1b9fdbf503aec7ad7d8 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 6 12:12:55 2023 -0500 feat(slur/swear blocker): work on Profiles commit 8f9822ffe8c820918f1ff59c3fd97faded9ad1f9 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 4 17:25:17 2023 -0500 feat(profiles/challenges): work on profile block & slack report commit bdb2e06e5e4fc9c34c0abc27139737be05d1320b Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 16:11:27 2023 -0500 feat(slur/swear): working on it commit 7277b5cad5ceb17c97fda22d871bf3e2edd104b7 Merge: 24d14277ab 941f1f976c Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 15:04:46 2023 -0500 Merge branch 'profile-slur-swear-blocker' into slur-swear-blocker commit 941f1f976c8a04f22a6843e70caea9e071e409b3 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 30 14:34:30 2023 -0500 feat(profiles/PMs): slur/swear blocker upgrade commit 0863017efc0f7a1832a296addabe68ba16278cf6 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 28 16:21:21 2023 -0500 feat(profiles): slur/swear blocker commit e9937d864ff35e9ac70c4c3c58d172187cdb3c3f Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 15:24:37 2023 -0500 feat(profiles): slur/swear blocker commit 24d14277ab84f7fb3c67aa666ef8ae4312c68cb5 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 14:12:46 2023 -0500 feat(challenges): update behavior based on public/private groups commit 1251f5b6a7ccc57f76b9979dc57c5dc3c712520e Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 16:28:29 2023 -0500 feat(challenges): swear and slur blocker commit a771045ca7dde5bd4edea83dcb5572e093da95f1 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 15:46:16 2023 -0500 feat(challenges): even more slur blocker commit e5e91aa78ad244a55e6f43f35bef5ef7b3254d9b Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 14:31:25 2023 -0500 feat(challenges): more slur blocker commit 50e824e4e3ebf1479deb17fd0ecf6d293c56db62 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 13 15:12:14 2023 -0500 feat(challenges): slur blocker commit 315ea24ef4ab846ddcc8a20ea09a58c6eb523a24 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Nov 3 12:31:12 2023 -0400 feat(challenges): slur blocker work commit 0f742d219fd5bcbb47b29e3c80d73284688490a7 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 2 16:22:31 2023 -0400 feat(challenges): add banned words & slur blocker to challenges commit 40d6b60ee3c8675b95646132d85f47b44a0bdbb4 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Oct 23 13:00:46 2023 -0400 update packages on local/origin repo
2024-01-10 21:14:11 +00:00
const text = `@${author} ${authorEmail} (${uuid}, ${language}) tried to post a slur in their Profile.`;
Automatically mute users who attempt to post a slur, fixes #8062 (#8177) * Initial psuedo-code for checking for slurs in messages * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Fixing rebase * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * First attempt at the muteUser function: revokes user's chat privileges and notifies moderators * Manual merge for cherry-pick * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Created report to be sent to moderators via email * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * Removed some code that got re-added after rebase * Tests for automatic slur muting pass but are incomplete (do not check that chatRevoked flag is true) * Moved list of banned slurs to server side * Added warning to bannedSlurs file * Test chat privileges revoked when posting slur in public chat * Fix issues left over after rebase (I hope) * Added code to test for revoked chat privileges after posting a slur in a private group * Moved banned slur message into locales message * Added new code to check for banned slurs (parallels banned words code) * Fixed AUTHOR_MOTAL_URL in sendTxn for slur blocking * Added tests that email sent on attempted slur in chat post * Created context for slur-related-tests, fixed sandboxing of email. Successfully tests that email.sendTxn is called, but the email content test fails * commented out slack (for now) and cleaned up tests of sending email * Successfully tests that slur-report-to-mods email is sent * Slack message is sent, and testing works, but some user variables seem to only work when found in chat.js and passed to slack * Made some fixes for lint, but not sure what to do about the camel case requirement fail, since that's how they're defined in other slack calls * Slack tests pass, skipped camelcase check around those code blocks * Fixed InternalServerError caused by slack messaging * Updated chat privileges revoked error * fix(locale): typo correction
2017-07-19 21:06:15 +00:00
flagSlack
.send({
text,
attachments: [{
fallback: 'Slur Message',
color: 'danger',
Squashed commit of the following: commit 83bcd07e20385d58f69f9490bf168307e454b2cc Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 17:24:45 2023 -0600 fix(profile): revert state on error commit 6aa6278727eb22c6133994f648ef0df3b0e7e866 Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 14:37:28 2023 -0600 fix(test): no longer care about swears in profile commit 0882c77038f43fdd237e8f75d52bef256fa97d42 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:15:42 2023 -0600 fix(lint): remove unused functions commit 9b275ef72d5315eb1ccd50c44a349d5b7d902bd3 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:09:11 2023 -0600 fix(profiles): restore reporting functionality Also remove unused and/or unrelated code and clean up comments commit f4ed8c14619456aa264543cd077f73db3fc374b8 Merge: da16aa9c75 f8ba191eea Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 12:11:00 2023 -0600 Merge branch 'release' into slur-swear-blocker commit da16aa9c75afefe2929e25bca0d47720cb1dd16a Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 21 13:20:28 2023 -0500 feat(s/s blocker): challenge updates to slack commit 51bed61c4c21241d5f0af1729cd9065e80a334cd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 19 15:36:59 2023 -0500 feat(s/s blocker): work on challenges commit 139cbcb21c47c86c760722c876358c2b6372e72f Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 13 13:20:45 2023 -0500 fix(slack): update Slack notification to include authorEmail and remove undefined commit 805b287721ede4a3a3a9f950afceebe55caf7d23 Author: SabreCat <sabe@habitica.com> Date: Tue Dec 12 16:35:54 2023 -0600 fix(profiles): improve profanity check logic commit 02ef7e8822a8b9e2680423fdebf5f03a2c51262f Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 17:22:29 2023 -0500 feat(slur blocker): arghhhhhh commit 949dee9b1ef659ee285fc603d30d4bdd48894ffd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 13:57:29 2023 -0500 feat(slur blocker): more refactoring commit bf953998f41ae7f2e7a25465321430f181f09769 Merge: d21aa687b7 f572aa442e Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 11 15:20:06 2023 -0500 Merge branch 'release' into slur-swear-blocker commit d21aa687b7b493a06a4079cf0b2ef90ad6565138 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 7 18:00:29 2023 -0500 feat(slur blocker): refactoring code commit f2db90c494b6c2705721e1b9fdbf503aec7ad7d8 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 6 12:12:55 2023 -0500 feat(slur/swear blocker): work on Profiles commit 8f9822ffe8c820918f1ff59c3fd97faded9ad1f9 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 4 17:25:17 2023 -0500 feat(profiles/challenges): work on profile block & slack report commit bdb2e06e5e4fc9c34c0abc27139737be05d1320b Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 16:11:27 2023 -0500 feat(slur/swear): working on it commit 7277b5cad5ceb17c97fda22d871bf3e2edd104b7 Merge: 24d14277ab 941f1f976c Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 15:04:46 2023 -0500 Merge branch 'profile-slur-swear-blocker' into slur-swear-blocker commit 941f1f976c8a04f22a6843e70caea9e071e409b3 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 30 14:34:30 2023 -0500 feat(profiles/PMs): slur/swear blocker upgrade commit 0863017efc0f7a1832a296addabe68ba16278cf6 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 28 16:21:21 2023 -0500 feat(profiles): slur/swear blocker commit e9937d864ff35e9ac70c4c3c58d172187cdb3c3f Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 15:24:37 2023 -0500 feat(profiles): slur/swear blocker commit 24d14277ab84f7fb3c67aa666ef8ae4312c68cb5 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 14:12:46 2023 -0500 feat(challenges): update behavior based on public/private groups commit 1251f5b6a7ccc57f76b9979dc57c5dc3c712520e Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 16:28:29 2023 -0500 feat(challenges): swear and slur blocker commit a771045ca7dde5bd4edea83dcb5572e093da95f1 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 15:46:16 2023 -0500 feat(challenges): even more slur blocker commit e5e91aa78ad244a55e6f43f35bef5ef7b3254d9b Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 14:31:25 2023 -0500 feat(challenges): more slur blocker commit 50e824e4e3ebf1479deb17fd0ecf6d293c56db62 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 13 15:12:14 2023 -0500 feat(challenges): slur blocker commit 315ea24ef4ab846ddcc8a20ea09a58c6eb523a24 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Nov 3 12:31:12 2023 -0400 feat(challenges): slur blocker work commit 0f742d219fd5bcbb47b29e3c80d73284688490a7 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 2 16:22:31 2023 -0400 feat(challenges): add banned words & slur blocker to challenges commit 40d6b60ee3c8675b95646132d85f47b44a0bdbb4 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Oct 23 13:00:46 2023 -0400 update packages on local/origin repo
2024-01-10 21:14:11 +00:00
author_email: authorEmail,
title,
title_link: titleLink,
Squashed commit of the following: commit 83bcd07e20385d58f69f9490bf168307e454b2cc Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 17:24:45 2023 -0600 fix(profile): revert state on error commit 6aa6278727eb22c6133994f648ef0df3b0e7e866 Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 14:37:28 2023 -0600 fix(test): no longer care about swears in profile commit 0882c77038f43fdd237e8f75d52bef256fa97d42 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:15:42 2023 -0600 fix(lint): remove unused functions commit 9b275ef72d5315eb1ccd50c44a349d5b7d902bd3 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:09:11 2023 -0600 fix(profiles): restore reporting functionality Also remove unused and/or unrelated code and clean up comments commit f4ed8c14619456aa264543cd077f73db3fc374b8 Merge: da16aa9c75 f8ba191eea Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 12:11:00 2023 -0600 Merge branch 'release' into slur-swear-blocker commit da16aa9c75afefe2929e25bca0d47720cb1dd16a Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 21 13:20:28 2023 -0500 feat(s/s blocker): challenge updates to slack commit 51bed61c4c21241d5f0af1729cd9065e80a334cd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 19 15:36:59 2023 -0500 feat(s/s blocker): work on challenges commit 139cbcb21c47c86c760722c876358c2b6372e72f Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 13 13:20:45 2023 -0500 fix(slack): update Slack notification to include authorEmail and remove undefined commit 805b287721ede4a3a3a9f950afceebe55caf7d23 Author: SabreCat <sabe@habitica.com> Date: Tue Dec 12 16:35:54 2023 -0600 fix(profiles): improve profanity check logic commit 02ef7e8822a8b9e2680423fdebf5f03a2c51262f Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 17:22:29 2023 -0500 feat(slur blocker): arghhhhhh commit 949dee9b1ef659ee285fc603d30d4bdd48894ffd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 13:57:29 2023 -0500 feat(slur blocker): more refactoring commit bf953998f41ae7f2e7a25465321430f181f09769 Merge: d21aa687b7 f572aa442e Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 11 15:20:06 2023 -0500 Merge branch 'release' into slur-swear-blocker commit d21aa687b7b493a06a4079cf0b2ef90ad6565138 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 7 18:00:29 2023 -0500 feat(slur blocker): refactoring code commit f2db90c494b6c2705721e1b9fdbf503aec7ad7d8 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 6 12:12:55 2023 -0500 feat(slur/swear blocker): work on Profiles commit 8f9822ffe8c820918f1ff59c3fd97faded9ad1f9 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 4 17:25:17 2023 -0500 feat(profiles/challenges): work on profile block & slack report commit bdb2e06e5e4fc9c34c0abc27139737be05d1320b Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 16:11:27 2023 -0500 feat(slur/swear): working on it commit 7277b5cad5ceb17c97fda22d871bf3e2edd104b7 Merge: 24d14277ab 941f1f976c Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 15:04:46 2023 -0500 Merge branch 'profile-slur-swear-blocker' into slur-swear-blocker commit 941f1f976c8a04f22a6843e70caea9e071e409b3 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 30 14:34:30 2023 -0500 feat(profiles/PMs): slur/swear blocker upgrade commit 0863017efc0f7a1832a296addabe68ba16278cf6 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 28 16:21:21 2023 -0500 feat(profiles): slur/swear blocker commit e9937d864ff35e9ac70c4c3c58d172187cdb3c3f Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 15:24:37 2023 -0500 feat(profiles): slur/swear blocker commit 24d14277ab84f7fb3c67aa666ef8ae4312c68cb5 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 14:12:46 2023 -0500 feat(challenges): update behavior based on public/private groups commit 1251f5b6a7ccc57f76b9979dc57c5dc3c712520e Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 16:28:29 2023 -0500 feat(challenges): swear and slur blocker commit a771045ca7dde5bd4edea83dcb5572e093da95f1 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 15:46:16 2023 -0500 feat(challenges): even more slur blocker commit e5e91aa78ad244a55e6f43f35bef5ef7b3254d9b Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 14:31:25 2023 -0500 feat(challenges): more slur blocker commit 50e824e4e3ebf1479deb17fd0ecf6d293c56db62 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 13 15:12:14 2023 -0500 feat(challenges): slur blocker commit 315ea24ef4ab846ddcc8a20ea09a58c6eb523a24 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Nov 3 12:31:12 2023 -0400 feat(challenges): slur blocker work commit 0f742d219fd5bcbb47b29e3c80d73284688490a7 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 2 16:22:31 2023 -0400 feat(challenges): add banned words & slur blocker to challenges commit 40d6b60ee3c8675b95646132d85f47b44a0bdbb4 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Oct 23 13:00:46 2023 -0400 update packages on local/origin repo
2024-01-10 21:14:11 +00:00
text: problemContent,
mrkdwn_in: [
'text',
],
}],
})
.catch(err => logger.error(err, 'Error while sending flag data to Slack.'));
Automatically mute users who attempt to post a slur, fixes #8062 (#8177) * Initial psuedo-code for checking for slurs in messages * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Fixing rebase * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * First attempt at the muteUser function: revokes user's chat privileges and notifies moderators * Manual merge for cherry-pick * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Created report to be sent to moderators via email * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * Removed some code that got re-added after rebase * Tests for automatic slur muting pass but are incomplete (do not check that chatRevoked flag is true) * Moved list of banned slurs to server side * Added warning to bannedSlurs file * Test chat privileges revoked when posting slur in public chat * Fix issues left over after rebase (I hope) * Added code to test for revoked chat privileges after posting a slur in a private group * Moved banned slur message into locales message * Added new code to check for banned slurs (parallels banned words code) * Fixed AUTHOR_MOTAL_URL in sendTxn for slur blocking * Added tests that email sent on attempted slur in chat post * Created context for slur-related-tests, fixed sandboxing of email. Successfully tests that email.sendTxn is called, but the email content test fails * commented out slack (for now) and cleaned up tests of sending email * Successfully tests that slur-report-to-mods email is sent * Slack message is sent, and testing works, but some user variables seem to only work when found in chat.js and passed to slack * Made some fixes for lint, but not sure what to do about the camel case requirement fail, since that's how they're defined in other slack calls * Slack tests pass, skipped camelcase check around those code blocks * Fixed InternalServerError caused by slack messaging * Updated chat privileges revoked error * fix(locale): typo correction
2017-07-19 21:06:15 +00:00
}
Slur swear blocker challenges redux (#15089) * update packages on local/origin repo * feat(challenges): add banned words & slur blocker to challenges * feat(challenges): slur blocker work * feat(challenges): slur blocker * feat(challenges): more slur blocker * feat(challenges): even more slur blocker * feat(challenges): swear and slur blocker * feat(challenges): update behavior based on public/private groups * feat(profiles): slur/swear blocker * feat(profiles): slur/swear blocker * feat(profiles/PMs): slur/swear blocker upgrade * feat(slur/swear): working on it * feat(profiles/challenges): work on profile block & slack report * feat(slur/swear blocker): work on Profiles * feat(slur blocker): refactoring code * feat(slur blocker): more refactoring * feat(slur blocker): arghhhhhh * fix(profiles): improve profanity check logic * fix(slack): update Slack notification to include authorEmail and remove undefined * feat(s/s blocker): work on challenges * feat(s/s blocker): challenge update * feat(s/s blocker): slack notifs refinements * feat(s/s blocker): refine slack notifs & disallow use of challenges POST API route if user is chatRevoked:true in db * update package.json and package-lock.json * attempt to disable create challenge button for muted users * another attempt to disable create challenge * block muted users from creating challenges * CSS button fun * fix CSS button * refactor(css): move button style to global Also, disable Clone button if user is chat revoked * fix(lint): remove unused fn * fix(challenges): handle null slur check * fix(groups): throw notFound earlier * fix(challenges): CSS and logic updates * fix(lint): remove whitespace * fix(challenges): don't disable create buttons * fix(slack): restore broken profile flag fields * chore(cleanup): remove comments and whitespace * chore(cleanup): one more white space --------- Co-authored-by: SabreCat <sabe@habitica.com>
2024-01-16 20:22:03 +00:00
function sendChallengeSlurNotification ({
authorEmail,
author,
language,
problemContent,
uuid,
}) {
if (SKIP_FLAG_METHODS) {
return;
}
const text = `${author.profile.name} ${authorEmail} (${uuid}, ${language}) tried to create a Challenge with a slur or banned word.`;
const authorName = formatUser({
name: author.auth.local.username,
displayName: author.profile.name,
email: authorEmail,
uuid: author.id,
language,
});
flagSlack
.send({
text,
attachments: [{
fallback: 'Slur Message',
color: 'danger',
author_name: authorName,
text: problemContent,
mrkdwn_in: [
'text',
],
}],
})
.catch(err => logger.error(err, 'Error while sending flag data to Slack.'));
}
export {
2018-06-02 16:14:53 +00:00
sendFlagNotification,
sendInboxFlagNotification,
Reporting challenges (#14756) * initial commit * update logic to display flagged challenges properly to users and admins * add report button to pages 'My Challenges' and 'Discover Challenges' * allow mods to view flagged messages on challengeDetail view * update showing flagged challenges for group challenges * update showing flagged challenges for a specific challenge * disallow closing a flagged challenge * update notes to reflect apiParams properly * fix css spacing * update challenge en locales * fix spacing * update title of closeChallengeModal * let user know flagged challenges cannot be cloned * fix linting errors * ensure flagged challenges cannot be declared with a winner and cloned via API * define a non user challenge properly * fix logic to check for a nonParticipant and nonLeader user when grabbing flagged challenges * fix linting of max character of 100 / line * remove reporting on 'my challenges' and 'discover challenges' * WIP(challenges): disable clone button and add notes to new functions * WIP(challenges): smol changes * WIP(challenges): clone button only disabled for admin and flagged user; other users can still clone but the flag goes along with the clone * WIP(challenges): stop flags carrying over on cloned challenges * WIP(challenges): typo fixing, undoing a smol change * fix(challenges): improved query logic for flags * WIP(challenges): more smol changes * fix(challenges): refactor queries * fix(challenges): correct My Challenges tab logic * WIP(challenges): fix clone button state * WIP(challenges): really fixed clone button & clear flags from clones * WIP(challenge): implement new design for reporting modal * WIP(challenge): making things pretty * WIP(challenge): conquering the close button * WIP(challenge): fixin some spacing * WIP(challenge): smol fix * WIP(challenge): making sure the button is actually disabled * WIP(challenge): fix blockquote css * fix(tests): no private guilds * fix(lint): curlies etc * fix(test): moderator permission * fix(lint): sure man whatever * fix(lint): bad vim no tabby * fix(test): permissions not contrib lol * fix(challenges): add icon and fix leaky CSS * fix(challenge): correct clone button behavior --------- Co-authored-by: Julius Jung <me@matchajune.io> Co-authored-by: SabreCat <sabe@habitica.com> Co-authored-by: Sabe Jones <sabrecat@gmail.com>
2023-10-24 14:24:56 +00:00
sendChallengeFlagNotification,
Squashed commit of the following: commit 3aba0abeddd5136c5312bee9d96a5febd80c0270 Author: SabreCat <sabe@habitica.com> Date: Mon Oct 2 20:51:20 2023 -0500 fix(router): use state to pass modal launch info commit 541eadd319ed48c7bbdbda25e3e5d0780b92e50a Merge: c0bb56c8c2 89fff49d02 Author: SabreCat <sabe@habitica.com> Date: Mon Oct 2 20:12:40 2023 -0500 Merge branch 'release' into report-profile-modal commit c0bb56c8c214203ab7b53790391c81d4833a88bc Author: SabreCat <sabe@habitica.com> Date: Wed Sep 27 16:15:28 2023 -0500 test(profiles): add integrations commit 9b644e9ad8ee09bdb457ad611c7618ced1984fb2 Author: SabreCat <sabe@habitica.com> Date: Tue Sep 26 17:17:22 2023 -0500 fix(profile): adjust margin commit bfefe5dfa9bdfb04b632bca7c9c49c6d36531fa8 Author: SabreCat <sabe@habitica.com> Date: Tue Sep 26 17:12:24 2023 -0500 fix(profiles): moar layout fixes commit 8f211ee3e2f7decf9426004ae5feb031a3d34fca Author: SabreCat <sabe@habitica.com> Date: Mon Sep 25 17:32:04 2023 -0500 fix(profile): fix admin actions Correct "user is banned" banner Fix bouncing modal Add "Days" smart plural Fix leaky CSS on Market page Refactor some redundant functions commit b1d23ec88b5414187d1f0220efa54410f92286b1 Merge: ee9709a9e1 a63cc84779 Author: SabreCat <sabe@habitica.com> Date: Mon Sep 25 15:37:54 2023 -0500 Merge branch 'release' into report-profile-modal commit ee9709a9e1499cbea5983543103bba62c4a82103 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Sep 18 16:30:30 2023 -0400 WIP(profile): add banned banner, toggle switches now toggle, add "days" to Next Login Reward commit f80928a8956d6db34b89dc203a43e471eef8fa51 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Sep 18 13:43:34 2023 -0400 update(node): update node modules commit 1d552f7e80735a0759cbc4777b49c7c552cd200d Author: SabreCat <sabe@habitica.com> Date: Fri Sep 15 16:52:22 2023 -0500 fix(import): remove empty import commit f55d74a95dcf7e8b2210be6e1a7f661389863ee6 Author: SabreCat <sabe@habitica.com> Date: Fri Sep 15 16:39:50 2023 -0500 refactor(profiles): remove email feature also still more visual cleanup of profile modal commit 311c74328440c99f05bc3b342ce1250838eca826 Author: SabreCat <sabe@habitica.com> Date: Fri Sep 15 15:44:56 2023 -0500 refactor(profile): remove page view commit f8632bf50d54008cca368e8bf7b4b302cc4367bf Merge: ec85159c65 9e25360102 Author: SabreCat <sabe@habitica.com> Date: Fri Sep 15 15:23:21 2023 -0500 Merge branch 'release' into report-profile-modal commit ec85159c65ed3a8b687713b54666dfb18b6cc93b Author: SabreCat <sabe@habitica.com> Date: Mon Sep 11 22:53:14 2023 -0500 feat(profiles): load modal instead of page? commit 99860829142e377a98775fb50a007ff7e7e301d0 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 8 14:49:57 2023 -0400 WIP(profile): fixed a comment, woohoo commit 6262a9ba0ca270eadc3c1a330a9917a4fd35cfa9 Merge: ae2b614df2 ea2b007b1a Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 8 13:40:23 2023 -0400 Merge remote-tracking branch 'origin/report-profile-modal' into report-profile-modal commit ea2b007b1a5459343dbf4dd49531768fbb8cad38 Author: SabreCat <sabe@habitica.com> Date: Thu Sep 7 16:54:19 2023 -0500 fix(profile): focus behavior commit ae2b614df20493c993bc830f41e671eae10d5297 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Sep 7 17:47:08 2023 -0400 WIP(profile): styling updates commit 2e0723f1b94595bd6a6d816abf9bf137f7241c75 Author: SabreCat <sabe@habitica.com> Date: Thu Sep 7 15:37:59 2023 -0500 feat(moderation): unflag profile Also a few stylistic tweaks commit edcf8113deb29e7d8540130f096717c9278b02fd Author: SabreCat <sabe@habitica.com> Date: Wed Sep 6 16:39:02 2023 -0500 WIP(profile): dropdown draft commit 0691483d63c9aa2a844c77034ad4215477c05ee4 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Sep 6 16:33:30 2023 -0400 WIP(profile): Styling and string updates commit 7e9d57d10a4aebbd373982a24da7108515352e15 Author: SabreCat <sabe@habitica.com> Date: Wed Sep 6 11:40:31 2023 -0500 feat(profile): functional dropdown buttons commit a2989b28330679d3f14198e3835f35079eb4e282 Merge: af6575e40c e072d7c09c Author: SabreCat <sabe@habitica.com> Date: Wed Sep 6 10:04:57 2023 -0500 Merge branch 'release' into report-profile-modal commit af6575e40cb2d78c813568f7bb690590d2ad754f Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Sep 6 11:01:05 2023 -0400 WIP(profile): comment cleanup commit 7b1de37202daea29c8c95e38dac9ff974b70ea8d Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Sep 5 17:22:14 2023 -0400 WIP(profile): remove shadowban tooltip commit d1177c32b9c012d838448b29601a6970bcb4e927 Merge: 321a01b081 31f821021b Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Sep 5 17:02:40 2023 -0400 Merge branch 'sabrecat/report-profile' into report-profile-modal commit 321a01b08120c6214793fcff14c09d011520e5a0 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 1 16:14:36 2023 -0400 WIP(profile): close button finally workinating commit e143d36d28f8a0e46d41931da021bacbae9649dc Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 1 15:52:38 2023 -0400 WIP(profile): close icon moved to profile.vue commit 31f821021b11de4c320d19ee6aadca845fc8afed Merge: a8f5e25d38 8957c5c009 Author: SabreCat <sabe@habitica.com> Date: Fri Sep 1 14:52:31 2023 -0500 Merge branch 'report-profile-modal' into sabrecat/report-profile commit 8957c5c009dac11a4a8c1292c603d101ca9ff216 Merge: d340f06a22 0aec3866a4 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 1 15:38:12 2023 -0400 Merge remote-tracking branch 'origin/report-profile-modal' into report-profile-modal commit d340f06a22691a929c87b464560c4d8b4046b0d6 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Sep 1 15:37:57 2023 -0400 WIP(profile): fixed user not found error commit 0aec3866a49a991a869cf13d33592ff80347306e Merge: b01f323b14 ac7c8e0eb6 Author: Natalie <78037386+CuriousMagpie@users.noreply.github.com> Date: Fri Sep 1 15:28:58 2023 -0400 Merge branch 'HabitRPG:develop' into report-profile-modal commit a8f5e25d38493d41b2f64f9abfe9cf754fd15481 Author: SabreCat <sabe@habitica.com> Date: Thu Aug 31 17:02:07 2023 -0500 feat(community): basic "report profile" commit b01f323b148aa46dc6371f3234e4912d50551a3a Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Aug 31 17:42:12 2023 -0400 WIP(profile): removed refactoring crud, located where close icon should be (profileModal.vue) commit ce7d51a20cdbeb4a32e750205759dbd748d95ccd Merge: 010f2299f0 ac7c8e0eb6 Author: SabreCat <sabe@habitica.com> Date: Thu Aug 31 14:20:37 2023 -0500 Merge branch 'release' into sabrecat/report-profile commit 18b41acd9440a9a2574d4d8a6056f740e7d00730 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Aug 31 12:23:41 2023 -0400 WIP(profile): moar buttonz commit 9387b3a6bc35a937f9558e3395e2eb291fd11f72 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 30 17:21:36 2023 -0400 WIP(profile): buttons commit b3ea48c4f5b30747b1b28d159818c05341994bb4 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Aug 25 15:52:41 2023 -0400 WIP(profile): work on achievement component commit a1ceb2ea7560e5bec9c1b6a7f7113db466855381 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Aug 25 14:39:12 2023 -0400 WIP(profile): create achievements component commit 4a24d9b80b434e752fcd22098691a05e80aa8fb1 Merge: 8fe263a377 1e05297e96 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 23 13:14:39 2023 -0400 Merge branch 'develop' into report-profile-modal commit 1e05297e96b0e9b25c7713dc8fee5c18dc9c27b8 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 23 13:12:52 2023 -0400 package updates commit 8fe263a377ffdfb59b667c0c2da9aa88924db78a Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 23 12:12:36 2023 -0400 update(dependencies): ran npm install to update dependencies commit 190fe048a11395d9cde11c6682fd3b9d06d9abbc Merge: 3ea48ab5cb fa83d1a9cf Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 23 11:52:08 2023 -0400 Merge branch 'develop' into report-profile-modal commit 3ea48ab5cb80b9eccbce82bdce01901b02a5c36e Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Aug 11 17:12:31 2023 -0400 WIP(user profile): dropdown menu and toggles and colors oh my commit c301a2b46025efa2a7fb33edac79be7e1bb467f3 Merge: 1da6af11b5 647b27c55f Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Aug 11 12:40:07 2023 -0400 Merge branch 'develop' into report-profile-modal commit 1da6af11b597bbbd2abba2d99007a32ff520d954 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Aug 10 16:50:07 2023 -0400 WIP(user profile): moved some CSS classes out of unscoped and into the scoped section, started on toggle buttons commit dd55cbc928b9a89c2c800d6e5e46e09aaf655ba4 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 9 15:38:46 2023 -0400 WIP(user profile): workin on the hamburger (kebab?) menu commit 3834093207443364e5f5906ce0a522f29c1a9924 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Aug 8 14:14:40 2023 -0400 WIP(user profiles): working on the drop down menu commit f2be5881950271cbeb67c7101054c8c3721d7f81 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Aug 7 16:10:30 2023 -0400 WIP(user profile): options menu commit 010f2299f0c0f2a6537c0989be039e8fa17a366b Author: SabreCat <sabe@habitica.com> Date: Mon Aug 7 11:49:04 2023 -0500 fix(lint): eof and const commit 4551dbf4b3f8def55480ac60224d2a4fbebbb4f2 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Aug 4 15:34:05 2023 -0400 WIP(user profile): styling the top portion of the modal commit 19a9fe36447646d56ea1d614cd75bff5f5328f61 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Aug 3 15:06:51 2023 -0400 WIP(user profile): adding buttons commit dfdb305b1c6eb3b455b386f5c19f603540e16644 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 2 14:41:20 2023 -0400 WIP(user profile): layout commit ded4eee6934a3085ac5b8c06d24d4fe3dbfb18ba Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Aug 2 12:04:02 2023 -0400 WIP(user profile): start flex grid & tidy up CSS commit aaca48be3214a9f33fc03d0cc028f694a4fa8cb0 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Jul 28 16:44:06 2023 -0400 WIP(user profile): mostly css updates commit e531985b8718b43339d11668c77109e1e52f7264 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Jul 27 16:49:44 2023 -0400 WIP(user profile): one infinitesimal change that's hardly worth the electricity it's made from commit eb4021fcc7e8b6bed195b9f337b95467e30cf0c6 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Jul 26 16:33:05 2023 -0400 feat(content): upgrade profile page commit 1b25394f3e5a7db92d4887edcc78bda0bff25508 Merge: c50cee0d88 8558dcc3a8 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Jul 26 11:50:12 2023 -0400 Merge branch 'develop' into report-profile-modal commit c50cee0d88b9ef1b52513f164f1c4824aef22405 Author: SabreCat <sabe@habitica.com> Date: Wed Jul 12 16:32:25 2023 -0500 fix(flagging): debug params issue Also add and document the "source" body param commit 55848c58bead479fdb687bb9a2e2b2a649a557e9 Author: SabreCat <sabe@habitica.com> Date: Mon Jul 10 16:24:20 2023 -0500 WIP(members): basic report a user API commit dda61807922655515e0fc9bbc075bd6f51491b9c Author: SabreCat <sabe@habitica.com> Date: Thu Jul 6 10:05:07 2023 -0500 fix(lint): remove console.info
2023-10-03 18:29:26 +00:00
sendProfileFlagNotification,
2018-06-02 16:14:53 +00:00
sendSubscriptionNotification,
sendShadowMutedPostNotification,
Squashed commit of the following: commit 83bcd07e20385d58f69f9490bf168307e454b2cc Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 17:24:45 2023 -0600 fix(profile): revert state on error commit 6aa6278727eb22c6133994f648ef0df3b0e7e866 Author: SabreCat <sabrecat@gmail.com> Date: Fri Dec 22 14:37:28 2023 -0600 fix(test): no longer care about swears in profile commit 0882c77038f43fdd237e8f75d52bef256fa97d42 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:15:42 2023 -0600 fix(lint): remove unused functions commit 9b275ef72d5315eb1ccd50c44a349d5b7d902bd3 Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 14:09:11 2023 -0600 fix(profiles): restore reporting functionality Also remove unused and/or unrelated code and clean up comments commit f4ed8c14619456aa264543cd077f73db3fc374b8 Merge: da16aa9c75 f8ba191eea Author: SabreCat <sabe@habitica.com> Date: Fri Dec 22 12:11:00 2023 -0600 Merge branch 'release' into slur-swear-blocker commit da16aa9c75afefe2929e25bca0d47720cb1dd16a Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 21 13:20:28 2023 -0500 feat(s/s blocker): challenge updates to slack commit 51bed61c4c21241d5f0af1729cd9065e80a334cd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 19 15:36:59 2023 -0500 feat(s/s blocker): work on challenges commit 139cbcb21c47c86c760722c876358c2b6372e72f Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 13 13:20:45 2023 -0500 fix(slack): update Slack notification to include authorEmail and remove undefined commit 805b287721ede4a3a3a9f950afceebe55caf7d23 Author: SabreCat <sabe@habitica.com> Date: Tue Dec 12 16:35:54 2023 -0600 fix(profiles): improve profanity check logic commit 02ef7e8822a8b9e2680423fdebf5f03a2c51262f Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 17:22:29 2023 -0500 feat(slur blocker): arghhhhhh commit 949dee9b1ef659ee285fc603d30d4bdd48894ffd Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Dec 12 13:57:29 2023 -0500 feat(slur blocker): more refactoring commit bf953998f41ae7f2e7a25465321430f181f09769 Merge: d21aa687b7 f572aa442e Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 11 15:20:06 2023 -0500 Merge branch 'release' into slur-swear-blocker commit d21aa687b7b493a06a4079cf0b2ef90ad6565138 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Dec 7 18:00:29 2023 -0500 feat(slur blocker): refactoring code commit f2db90c494b6c2705721e1b9fdbf503aec7ad7d8 Author: CuriousMagpie <eilatan@gmail.com> Date: Wed Dec 6 12:12:55 2023 -0500 feat(slur/swear blocker): work on Profiles commit 8f9822ffe8c820918f1ff59c3fd97faded9ad1f9 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Dec 4 17:25:17 2023 -0500 feat(profiles/challenges): work on profile block & slack report commit bdb2e06e5e4fc9c34c0abc27139737be05d1320b Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 16:11:27 2023 -0500 feat(slur/swear): working on it commit 7277b5cad5ceb17c97fda22d871bf3e2edd104b7 Merge: 24d14277ab 941f1f976c Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Dec 1 15:04:46 2023 -0500 Merge branch 'profile-slur-swear-blocker' into slur-swear-blocker commit 941f1f976c8a04f22a6843e70caea9e071e409b3 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 30 14:34:30 2023 -0500 feat(profiles/PMs): slur/swear blocker upgrade commit 0863017efc0f7a1832a296addabe68ba16278cf6 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 28 16:21:21 2023 -0500 feat(profiles): slur/swear blocker commit e9937d864ff35e9ac70c4c3c58d172187cdb3c3f Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 15:24:37 2023 -0500 feat(profiles): slur/swear blocker commit 24d14277ab84f7fb3c67aa666ef8ae4312c68cb5 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 27 14:12:46 2023 -0500 feat(challenges): update behavior based on public/private groups commit 1251f5b6a7ccc57f76b9979dc57c5dc3c712520e Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 16:28:29 2023 -0500 feat(challenges): swear and slur blocker commit a771045ca7dde5bd4edea83dcb5572e093da95f1 Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 15:46:16 2023 -0500 feat(challenges): even more slur blocker commit e5e91aa78ad244a55e6f43f35bef5ef7b3254d9b Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Nov 14 14:31:25 2023 -0500 feat(challenges): more slur blocker commit 50e824e4e3ebf1479deb17fd0ecf6d293c56db62 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Nov 13 15:12:14 2023 -0500 feat(challenges): slur blocker commit 315ea24ef4ab846ddcc8a20ea09a58c6eb523a24 Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Nov 3 12:31:12 2023 -0400 feat(challenges): slur blocker work commit 0f742d219fd5bcbb47b29e3c80d73284688490a7 Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Nov 2 16:22:31 2023 -0400 feat(challenges): add banned words & slur blocker to challenges commit 40d6b60ee3c8675b95646132d85f47b44a0bdbb4 Author: CuriousMagpie <eilatan@gmail.com> Date: Mon Oct 23 13:00:46 2023 -0400 update packages on local/origin repo
2024-01-10 21:14:11 +00:00
sendProfileSlurNotification,
Slur swear blocker challenges redux (#15089) * update packages on local/origin repo * feat(challenges): add banned words & slur blocker to challenges * feat(challenges): slur blocker work * feat(challenges): slur blocker * feat(challenges): more slur blocker * feat(challenges): even more slur blocker * feat(challenges): swear and slur blocker * feat(challenges): update behavior based on public/private groups * feat(profiles): slur/swear blocker * feat(profiles): slur/swear blocker * feat(profiles/PMs): slur/swear blocker upgrade * feat(slur/swear): working on it * feat(profiles/challenges): work on profile block & slack report * feat(slur/swear blocker): work on Profiles * feat(slur blocker): refactoring code * feat(slur blocker): more refactoring * feat(slur blocker): arghhhhhh * fix(profiles): improve profanity check logic * fix(slack): update Slack notification to include authorEmail and remove undefined * feat(s/s blocker): work on challenges * feat(s/s blocker): challenge update * feat(s/s blocker): slack notifs refinements * feat(s/s blocker): refine slack notifs & disallow use of challenges POST API route if user is chatRevoked:true in db * update package.json and package-lock.json * attempt to disable create challenge button for muted users * another attempt to disable create challenge * block muted users from creating challenges * CSS button fun * fix CSS button * refactor(css): move button style to global Also, disable Clone button if user is chat revoked * fix(lint): remove unused fn * fix(challenges): handle null slur check * fix(groups): throw notFound earlier * fix(challenges): CSS and logic updates * fix(lint): remove whitespace * fix(challenges): don't disable create buttons * fix(slack): restore broken profile flag fields * chore(cleanup): remove comments and whitespace * chore(cleanup): one more white space --------- Co-authored-by: SabreCat <sabe@habitica.com>
2024-01-16 20:22:03 +00:00
sendChallengeSlurNotification,
formatUser,
Automatically mute users who attempt to post a slur, fixes #8062 (#8177) * Initial psuedo-code for checking for slurs in messages * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Fixing rebase * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * First attempt at the muteUser function: revokes user's chat privileges and notifies moderators * Manual merge for cherry-pick * Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check. * Permanently revoke chat privileges when attempting to post a slur. * Removed console logs * Created report to be sent to moderators via email * Do not moderate private groups * Moved slur check to a generic check for banned words function * Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function * Slurs are blocked in both public and private groups * Added code to send a slack message for slurs * Fixed formatting issues * Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check * Added initial tests for blocking slurs and revoking chat priviliges * Uncommented line to save revoked privileges * Check that privileges are revoked in private groups * Moved code to email/slack mods to chat api file * Switched to BadRequest instead of NotFound error * Restore chat privileges after test * Using official placeholder slur * Fixed line to export sendSubscriptionNotification function for slack * Replaced muteUser function in user methods with a single line in the chat controller file * Reset chatRevoked flag to false in a single line * Switched method of setting chatRevoked flag so that it is updated locally and in the database * Removed some code that got re-added after rebase * Tests for automatic slur muting pass but are incomplete (do not check that chatRevoked flag is true) * Moved list of banned slurs to server side * Added warning to bannedSlurs file * Test chat privileges revoked when posting slur in public chat * Fix issues left over after rebase (I hope) * Added code to test for revoked chat privileges after posting a slur in a private group * Moved banned slur message into locales message * Added new code to check for banned slurs (parallels banned words code) * Fixed AUTHOR_MOTAL_URL in sendTxn for slur blocking * Added tests that email sent on attempted slur in chat post * Created context for slur-related-tests, fixed sandboxing of email. Successfully tests that email.sendTxn is called, but the email content test fails * commented out slack (for now) and cleaned up tests of sending email * Successfully tests that slur-report-to-mods email is sent * Slack message is sent, and testing works, but some user variables seem to only work when found in chat.js and passed to slack * Made some fixes for lint, but not sure what to do about the camel case requirement fail, since that's how they're defined in other slack calls * Slack tests pass, skipped camelcase check around those code blocks * Fixed InternalServerError caused by slack messaging * Updated chat privileges revoked error * fix(locale): typo correction
2017-07-19 21:06:15 +00:00
};