Skip to content

A platform for community discussion. Free, open, simple.

UX: improve the list of options on the slow mode modal (#16561)

Andrei Prigorshnevbadde13894ef
diff --git a/app/assets/javascripts/discourse/app/controllers/edit-slow-mode.js b/app/assets/javascripts/discourse/app/controllers/edit-slow-mode.js
index d666c40d7a9..fa95a69e8f2 100644
--- a/app/assets/javascripts/discourse/app/controllers/edit-slow-mode.js
+++ b/app/assets/javascripts/discourse/app/controllers/edit-slow-mode.js
@@ -112,17 +112,18 @@ export default Controller.extend(ModalFunctionality, {
timeShortcuts() {
const timezone = this.currentUser.resolvedTimezone(this.currentUser);
const shortcuts = timeShortcuts(timezone);
+
+ const nextWeek = shortcuts.monday();
+ nextWeek.label = "time_shortcut.next_week";
+
return [
shortcuts.laterToday(),
shortcuts.tomorrow(),
- shortcuts.laterThisWeek(),
- shortcuts.monday(),
+ shortcuts.twoDays(),
+ nextWeek,
shortcuts.twoWeeks(),
shortcuts.nextMonth(),
shortcuts.twoMonths(),
- shortcuts.threeMonths(),
- shortcuts.fourMonths(),
- shortcuts.sixMonths(),
];
},
diff --git a/app/assets/javascripts/discourse/app/lib/time-shortcut.js b/app/assets/javascripts/discourse/app/lib/time-shortcut.js
index 6d5751dc587..05558f3a8a8 100644
--- a/app/assets/javascripts/discourse/app/lib/time-shortcut.js
+++ b/app/assets/javascripts/discourse/app/lib/time-shortcut.js
@@ -17,6 +17,7 @@ import {
thousandYears,
threeMonths,
tomorrow,
+ twoDays,
twoMonths,
twoWeeks,
} from "discourse/lib/time-utils";
@@ -94,6 +95,15 @@ export function timeShortcuts(timezone) {
timeFormatKey: "dates.time_short_day",
};
},
+ twoDays() {
+ return {
+ id: "two_days",
+ icon: "angle-right",
+ label: "time_shortcut.two_days",
+ time: twoDays(timezone),
+ timeFormatKey: "dates.time_short_day",
+ };
+ },
laterThisWeek() {
return {
id: TIME_SHORTCUT_TYPES.LATER_THIS_WEEK,
diff --git a/app/assets/javascripts/discourse/app/lib/time-utils.js b/app/assets/javascripts/discourse/app/lib/time-utils.js
index 07063410f3c..049bb8ecfd5 100644
--- a/app/assets/javascripts/discourse/app/lib/time-utils.js
+++ b/app/assets/javascripts/discourse/app/lib/time-utils.js
@@ -37,10 +37,14 @@ export function laterToday(timezone) {
: later.add(30, "minutes").startOf("hour");
}
-export function laterThisWeek(timezone) {
+export function twoDays(timezone) {
return startOfDay(now(timezone).add(2, "days"));
}
+export function laterThisWeek(timezone) {
+ return twoDays(timezone);
+}
+
export function nextMonth(timezone) {
return startOfDay(now(timezone).add(1, "month").startOf("month"));
}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-set-slow-mode-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-set-slow-mode-test.js
index 3d8666b64bc..e9747a2c386 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/topic-set-slow-mode-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-set-slow-mode-test.js
@@ -54,14 +54,11 @@ acceptance("Topic - Set Slow Mode", function (needs) {
const expected = [
I18n.t("time_shortcut.later_today"),
I18n.t("time_shortcut.tomorrow"),
- I18n.t("time_shortcut.later_this_week"),
- I18n.t("time_shortcut.start_of_next_business_week_alt"),
+ I18n.t("time_shortcut.two_days"),
+ I18n.t("time_shortcut.next_week"),
I18n.t("time_shortcut.two_weeks"),
I18n.t("time_shortcut.next_month"),
I18n.t("time_shortcut.two_months"),
- I18n.t("time_shortcut.three_months"),
- I18n.t("time_shortcut.four_months"),
- I18n.t("time_shortcut.six_months"),
I18n.t("time_shortcut.custom"),
];
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 219ee93264f..4f388ea660f 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -642,6 +642,7 @@ en:
time_shortcut:
later_today: "Later today"
+ two_days: "Two days"
next_business_day: "Next business day"
tomorrow: "Tomorrow"
post_local_date: "Date in post"
@@ -649,6 +650,7 @@ en:
this_weekend: "This weekend"
start_of_next_business_week: "Monday"
start_of_next_business_week_alt: "Next Monday"
+ next_week: "Next week"
two_weeks: "Two weeks"
next_month: "Next month"
two_months: "Two months"