FEATURE: Tweak slow mode messages and intervals (#12704)

This commit is contained in:
Andrei Prigorshnev 2021-04-15 13:56:10 +04:00 committed by GitHub
parent 81498bd131
commit 3326d1ff73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 10 deletions

View File

@ -690,8 +690,13 @@ export default Controller.extend({
topic.user_last_posted_at
)
) {
const canPostAt = new moment(topic.user_last_posted_at).add(
topic.slow_mode_seconds,
"seconds"
);
const timeLeft = moment().diff(canPostAt, "seconds");
const message = I18n.t("composer.slow_mode.error", {
duration: durationTextFromSeconds(topic.slow_mode_seconds),
timeLeft: durationTextFromSeconds(timeLeft),
});
bootbox.alert(message);

View File

@ -21,25 +21,45 @@ export default Controller.extend(ModalFunctionality, {
this._super(...arguments);
this.set("slowModes", [
{
id: "600",
name: I18n.t("topic.slow_mode_update.durations.10_minutes"),
},
{
id: "900",
name: I18n.t("topic.slow_mode_update.durations.15_minutes"),
},
{
id: "1800",
name: I18n.t("topic.slow_mode_update.durations.30_minutes"),
},
{
id: "2700",
name: I18n.t("topic.slow_mode_update.durations.45_minutes"),
},
{
id: "3600",
name: I18n.t("topic.slow_mode_update.durations.1_hour"),
},
{
id: "7200",
name: I18n.t("topic.slow_mode_update.durations.2_hours"),
},
{
id: "14400",
name: I18n.t("topic.slow_mode_update.durations.4_hours"),
},
{
id: "86400",
name: I18n.t("topic.slow_mode_update.durations.1_day"),
id: "28800",
name: I18n.t("topic.slow_mode_update.durations.8_hours"),
},
{
id: "604800",
name: I18n.t("topic.slow_mode_update.durations.1_week"),
id: "43200",
name: I18n.t("topic.slow_mode_update.durations.12_hours"),
},
{
id: "86400",
name: I18n.t("topic.slow_mode_update.durations.24_hours"),
},
{
id: "custom",

View File

@ -2074,7 +2074,7 @@ en:
title: "Did you forget to add recipients?"
body: "Right now this message is only being sent to yourself!"
slow_mode:
error: "This topic is in slow mode. In order to promote thoughtful, considered discussion you may only post once every %{duration}."
error: "This topic is in slow mode. You already posted recently; you can post again in %{timeLeft}."
admin_options_title: "Optional staff settings for this topic"
@ -2486,14 +2486,19 @@ en:
minutes: "Minutes:"
seconds: "Seconds:"
durations:
10_minutes: "10 Minutes"
15_minutes: "15 Minutes"
30_minutes: "30 Minutes"
45_minutes: "45 Minutes"
1_hour: "1 Hour"
2_hours: "2 Hours"
4_hours: "4 Hours"
1_day: "1 Day"
1_week: "1 Week"
8_hours: "8 Hours"
12_hours: "12 Hours"
24_hours: "24 Hours"
custom: "Custom Duration"
slow_mode_notice:
duration: "You need to wait %{duration} between posts in this topic"
duration: "Please wait %{duration} between posts in this topic"
topic_status_update:
title: "Topic Timer"
save: "Set Timer"

View File

@ -410,7 +410,7 @@ en:
too_late_to_edit: "That post was created too long ago. It can no longer be edited or deleted."
edit_conflict: "That post was edited by another user and your changes can no longer be saved."
revert_version_same: "The current version is same as the version you are trying to revert to."
cannot_edit_on_slow_mode: "This topic is in slow mode. To encourage thoughtful, considered discussion, editing old posts is not currently allowed."
cannot_edit_on_slow_mode: "This topic is in slow mode. To encourage thoughtful, considered discussion, editing old posts in this topic is not currently allowed during slow mode."
excerpt_image: "image"