Skip to content

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

UI: Slow mode tweaks. (#11081)

Roman Rizzi7912ce4002f4
diff --git a/app/assets/javascripts/discourse/app/components/composer-messages.js b/app/assets/javascripts/discourse/app/components/composer-messages.js
index e3fbca18589..3273da6b16c 100644
--- a/app/assets/javascripts/discourse/app/components/composer-messages.js
+++ b/app/assets/javascripts/discourse/app/components/composer-messages.js
@@ -4,7 +4,6 @@ import EmberObject from "@ember/object";
import { scheduleOnce } from "@ember/runloop";
import Component from "@ember/component";
import LinkLookup from "discourse/lib/link-lookup";
-import { durationTextFromSeconds } from "discourse/helpers/slow-mode";
let _messagesCache = {};
@@ -117,21 +116,6 @@ export default Component.extend({
}
}
- const topic = composer.topic;
- if (topic && topic.slow_mode_seconds) {
- const msg = composer.store.createRecord("composer-message", {
- id: "slow-mode-enabled",
- extraClass: "custom-body",
- templateName: "custom-body",
- title: I18n.t("composer.slow_mode.title"),
- body: I18n.t("composer.slow_mode.body", {
- duration: durationTextFromSeconds(topic.slow_mode_seconds),
- }),
- });
-
- this.send("popup", msg);
- }
-
this.queuedForTyping.forEach((msg) => this.send("popup", msg));
},
diff --git a/app/assets/javascripts/discourse/app/controllers/composer.js b/app/assets/javascripts/discourse/app/controllers/composer.js
index 488a975bd93..cb24c87a7ee 100644
--- a/app/assets/javascripts/discourse/app/controllers/composer.js
+++ b/app/assets/javascripts/discourse/app/controllers/composer.js
@@ -28,7 +28,10 @@ import { isTesting } from "discourse-common/config/environment";
import EmberObject, { computed, action } from "@ember/object";
import deprecated from "discourse-common/lib/deprecated";
import bootbox from "bootbox";
-import { cannotPostAgain } from "discourse/helpers/slow-mode";
+import {
+ cannotPostAgain,
+ durationTextFromSeconds,
+} from "discourse/helpers/slow-mode";
function loadDraft(store, opts) {
let promise = Promise.resolve();
@@ -661,10 +664,15 @@ export default Controller.extend({
topic.user_last_posted_at
)
) {
- const message = I18n.t("composer.slow_mode.error");
+ const message = I18n.t("composer.slow_mode.error", {
+ duration: durationTextFromSeconds(topic.slow_mode_seconds),
+ });
bootbox.alert(message);
return;
+ } else {
+ // Edge case where the user tries to post again immediately.
+ topic.set("user_last_posted_at", new Date().toISOString());
}
}
diff --git a/app/assets/javascripts/discourse/app/templates/components/slow-mode-info.hbs b/app/assets/javascripts/discourse/app/templates/components/slow-mode-info.hbs
index c393ee78a48..21ae5a3cd61 100644
--- a/app/assets/javascripts/discourse/app/templates/components/slow-mode-info.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/slow-mode-info.hbs
@@ -2,7 +2,7 @@
<div class="topic-status-info">
<h3 class="slow-mode-heading">
<span>
- {{d-icon "hourglass-end"}}
+ {{d-icon "hourglass-start"}}
{{i18n "topic.slow_mode_notice.duration" duration=durationText}}
</span>
diff --git a/app/assets/javascripts/discourse/app/templates/modal/edit-slow-mode.hbs b/app/assets/javascripts/discourse/app/templates/modal/edit-slow-mode.hbs
index 29cd5fcb399..956db77d769 100644
--- a/app/assets/javascripts/discourse/app/templates/modal/edit-slow-mode.hbs
+++ b/app/assets/javascripts/discourse/app/templates/modal/edit-slow-mode.hbs
@@ -30,6 +30,7 @@
<div class="modal-footer">
{{d-button class="btn-primary"
disabled=submitDisabled
+ icon="hourglass-start"
label="topic.slow_mode_update.save"
action=(action "enableSlowMode")}}
diff --git a/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js b/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js
index 6d9447e0d15..f5e1eb5f42f 100644
--- a/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js
+++ b/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js
@@ -274,7 +274,7 @@ export default createWidget("topic-admin-menu", {
className: "topic-admin-slow-mode",
buttonClass: "popup-menu-btn",
action: "showTopicSlowModeUpdate",
- icon: "hourglass-end",
+ icon: "hourglass-start",
label: "actions.slow_mode",
});
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 061fe1e0cbb..d257c71b3fe 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1925,9 +1925,7 @@ en:
title: "Did you forget to add recipients?"
body: "Right now this message is only being sent to yourself!"
slow_mode:
- title: "This topic is in slow mode."
- body: "After submitting a post, you'll need to wait %{duration} before being able to post again."
- error: "You recently posted on this topic, which is in slow mode. Please wait so other users can have their chance to participate."
+ error: "This topic is in slow mode. In order to promote thoughtful, considered discussion you may only post once every %{duration}."
admin_options_title: "Optional staff settings for this topic"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 608a288af52..4c2c6fe0a52 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -384,7 +384,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: "The topic is in slow mode and that post can no longer be edited."
+ cannot_edit_on_slow_mode: "This topic is in slow mode. To encourage thoughtful, considered discussion, editing old posts is not currently allowed."
excerpt_image: "image"
diff --git a/lib/svg_sprite/svg_sprite.rb b/lib/svg_sprite/svg_sprite.rb
index ffa83a3644f..364e70aecb5 100644
--- a/lib/svg_sprite/svg_sprite.rb
+++ b/lib/svg_sprite/svg_sprite.rb
@@ -130,7 +130,7 @@ module SvgSprite
"heading",
"heart",
"home",
- "hourglass-end",
+ "hourglass-start",
"id-card",
"info-circle",
"italic",