mirror of
https://github.com/discourse/discourse.git
synced 2025-06-10 19:33:52 +08:00
FEATURE: site setting to include post in penalty messages (#26025)
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:
@ -19,6 +19,13 @@ export default class PenalizeUser extends Component {
|
|||||||
@tracked reason;
|
@tracked reason;
|
||||||
@tracked message;
|
@tracked message;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super(...arguments);
|
||||||
|
if (this.postEdit && this.siteSettings.penalty_include_post_message) {
|
||||||
|
this.message = `-------------------\n${this.postEdit}\n-------------------`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get modalTitle() {
|
get modalTitle() {
|
||||||
if (this.args.model.penaltyType === "suspend") {
|
if (this.args.model.penaltyType === "suspend") {
|
||||||
return "admin.user.suspend_modal_title";
|
return "admin.user.suspend_modal_title";
|
||||||
|
@ -128,7 +128,11 @@ acceptance("flagging", function (needs) {
|
|||||||
await selectKit(".reviewable-action-dropdown").expand();
|
await selectKit(".reviewable-action-dropdown").expand();
|
||||||
await click("[data-value='agree_and_silence']");
|
await click("[data-value='agree_and_silence']");
|
||||||
assert.ok(exists(".silence-user-modal"), "it shows the silence modal");
|
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");
|
const silenceUntilCombobox = selectKit(".silence-until .combobox");
|
||||||
await silenceUntilCombobox.expand();
|
await silenceUntilCombobox.expand();
|
||||||
await silenceUntilCombobox.selectRowByValue("tomorrow");
|
await silenceUntilCombobox.selectRowByValue("tomorrow");
|
||||||
@ -139,6 +143,21 @@ acceptance("flagging", function (needs) {
|
|||||||
assert.ok(!exists(".d-modal__body"));
|
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) {
|
test("Can delete spammer from spam", async function (assert) {
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await openFlagModal();
|
await openFlagModal();
|
||||||
|
@ -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."
|
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_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."
|
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)"
|
max_prints_per_hour_per_user: "Maximum number of /print page impressions (set to 0 to disable printing)"
|
||||||
|
|
||||||
|
@ -2827,6 +2827,10 @@ uncategorized:
|
|||||||
type: "list"
|
type: "list"
|
||||||
list_type: "compact"
|
list_type: "compact"
|
||||||
|
|
||||||
|
penalty_include_post_message:
|
||||||
|
default: false
|
||||||
|
client: true
|
||||||
|
|
||||||
svg_icon_subset:
|
svg_icon_subset:
|
||||||
default: ""
|
default: ""
|
||||||
type: "list"
|
type: "list"
|
||||||
|
Reference in New Issue
Block a user