FEATURE: site setting to include post in penalty messages (#26026)

Adds a site setting to include a post's content in penalty message.
When silencing/suspending a user from a post, or a reviewable with
a post, adds an option to include a post's content in the email
message by default.
This commit is contained in:
Jeff Wong 2024-03-04 18:35:35 -08:00 committed by GitHub
parent 1167b5b9a5
commit 895a018e9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 32 additions and 1 deletions

View File

@ -19,6 +19,13 @@ export default class PenalizeUser extends Component {
@tracked reason;
@tracked message;
constructor() {
super(...arguments);
if (this.postEdit && this.siteSettings.penalty_include_post_message) {
this.message = `-------------------\n${this.postEdit}\n-------------------`;
}
}
get modalTitle() {
if (this.args.model.penaltyType === "suspend") {
return "admin.user.suspend_modal_title";

View File

@ -128,7 +128,11 @@ acceptance("flagging", function (needs) {
await selectKit(".reviewable-action-dropdown").expand();
await click("[data-value='agree_and_silence']");
assert.ok(exists(".silence-user-modal"), "it shows the silence modal");
assert.equal(
query(".suspend-message").value,
"",
"penalty message is empty"
);
const silenceUntilCombobox = selectKit(".silence-until .combobox");
await silenceUntilCombobox.expand();
await silenceUntilCombobox.selectRowByValue("tomorrow");
@ -139,6 +143,21 @@ acceptance("flagging", function (needs) {
assert.ok(!exists(".d-modal__body"));
});
test("Message appears in penalty modal", async function (assert) {
this.siteSettings.penalty_include_post_message = true;
await visit("/t/internationalization-localization/280");
await openFlagModal();
await click("#radio_inappropriate");
await selectKit(".reviewable-action-dropdown").expand();
await click("[data-value='agree_and_silence']");
assert.ok(exists(".silence-user-modal"), "it shows the silence modal");
assert.equal(
query(".suspend-message").value,
"-------------------\n<p>Any plans to support localization of UI elements, so that I (for example) could set up a completely German speaking forum?</p>\n-------------------",
"penalty message is prefilled with post text"
);
});
test("Can delete spammer from spam", async function (assert) {
await visit("/t/internationalization-localization/280");
await openFlagModal();

View File

@ -2279,6 +2279,7 @@ en:
auto_handle_queued_age: "Automatically handle records that are waiting to be reviewed after this many days. Flags will be ignored. Queued posts and users will be rejected. Set to 0 to disable this feature."
penalty_step_hours: "Default penalties for silencing or suspending users in hours. First offense defaults to the first value, second offense defaults to the second value, etc."
penalty_include_post_message: "Automatically include offending post message in email message template when silencing or suspending a user"
svg_icon_subset: "Add additional FontAwesome 5 icons that you would like to include in your assets. Use prefix 'fa-' for solid icons, 'far-' for regular icons and 'fab-' for brand icons."
max_prints_per_hour_per_user: "Maximum number of /print page impressions (set to 0 to disable printing)"

View File

@ -2828,6 +2828,10 @@ uncategorized:
type: "list"
list_type: "compact"
penalty_include_post_message:
default: false
client: true
svg_icon_subset:
default: ""
type: "list"