diff --git a/app/assets/javascripts/admin/addon/components/modal/penalize-user.js b/app/assets/javascripts/admin/addon/components/modal/penalize-user.js index 8f270d5c333..23a1b3e0425 100644 --- a/app/assets/javascripts/admin/addon/components/modal/penalize-user.js +++ b/app/assets/javascripts/admin/addon/components/modal/penalize-user.js @@ -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"; diff --git a/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js b/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js index 4cdaf972536..58d48c80f3f 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js @@ -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

Any plans to support localization of UI elements, so that I (for example) could set up a completely German speaking forum?

\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(); diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 6c93dae22b2..5c8fc5e1b6c 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -2334,6 +2334,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)" diff --git a/config/site_settings.yml b/config/site_settings.yml index 2ca5984ce41..deeee1a87c0 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -2827,6 +2827,10 @@ uncategorized: type: "list" list_type: "compact" + penalty_include_post_message: + default: false + client: true + svg_icon_subset: default: "" type: "list"