Skip to content

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

UX: Correct educate message when there are no new topics (#21943)

Alan Guo Xiang Tan664295870675
diff --git a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js b/app/assets/javascripts/discourse/app/controllers/discovery/topics.js
index e1b7dc2c4cd..2b2f5e1c71e 100644
--- a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js
+++ b/app/assets/javascripts/discourse/app/controllers/discovery/topics.js
@@ -195,14 +195,19 @@ const controllerOpts = {
const segments = (this.get("model.filter") || "").split("/");
- const tab = segments[segments.length - 1];
+ let tab = segments[segments.length - 1];
+
if (tab !== "new" && tab !== "unread") {
return;
}
+ if (tab === "new" && this.currentUser.new_new_view_enabled) {
+ tab = "new_new";
+ }
+
return I18n.t("topics.none.educate." + tab, {
userPrefsUrl: userPath(
- `${this.currentUser.get("username_lower")}/preferences/notifications`
+ `${this.currentUser.get("username_lower")}/preferences/tracking`
),
});
},
diff --git a/app/assets/javascripts/discourse/tests/acceptance/new-topics-test.js b/app/assets/javascripts/discourse/tests/acceptance/new-topics-test.js
new file mode 100644
index 00000000000..bba685b047b
--- /dev/null
+++ b/app/assets/javascripts/discourse/tests/acceptance/new-topics-test.js
@@ -0,0 +1,31 @@
+import I18n from "I18n";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
+import { test } from "qunit";
+import { visit } from "@ember/test-helpers";
+
+acceptance("New Topics - New new view enabled", function (needs) {
+ needs.user({
+ new_new_view_enabled: true,
+ });
+
+ needs.pretender((server, helper) => {
+ server.get("/new.json", () => {
+ return helper.response({
+ topic_list: { can_create_topic: true, topics: [] },
+ });
+ });
+ });
+
+ test("visiting new page when there are no new topics", async function (assert) {
+ await visit("/new");
+
+ const text = new DOMParser().parseFromString(
+ I18n.t("topics.none.educate.new_new", {
+ userPrefsUrl: "/u/eviltrout/preferences/tracking",
+ }),
+ "text/html"
+ ).documentElement.textContent;
+
+ assert.dom(".topic-list-bottom .education").hasText(text);
+ });
+});
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 712e48ee540..939e47ffe9e 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -2907,7 +2907,8 @@ en:
filter: "There are no topics."
educate:
new: '<p>Your new topics will appear here. By default, topics are considered new and will show a <span class="badge new-topic badge-notification" style="vertical-align:middle;line-height:inherit;"></span> indicator if they were created in the last 2 days.</p><p>Visit your <a href="%{userPrefsUrl}">preferences</a> to change this.</p>'
- unread: '<p>Your unread topics appear here.</p><p>By default, topics are considered unread and will show unread counts <span class="badge unread-posts badge-notification">1</span> if you:</p><ul><li>Created the topic</li><li>Replied to the topic</li><li>Read the topic for more than 4 minutes</li></ul><p>Or if you have explicitly set the topic to Tracked or Watched via the πŸ”” in each topic.</p><p>Visit your <a href="%{userPrefsUrl}">preferences</a> to change this.</p>'
+ unread: '<p>Your unread topics appear here.</p><p>By default, topics are considered unread and will show unread counts <span class="badge unread-posts badge-notification">1</span> if you:</p><ul><li>Created the topic</li><li>Replied to the topic</li><li>Read the topic for more than 5 minutes</li></ul><p>Or if you have explicitly set the topic to Tracked or Watched via the πŸ”” in each topic.</p><p>Visit your <a href="%{userPrefsUrl}">preferences</a> to change this.</p>'
+ new_new: '<p>Your new topics will appear here, and your unread topics will also be displayed. By default, topics are considered new and will show a <span class="badge new-topic badge-notification" style="vertical-align:middle;line-height:inherit;"></span> indicator if they were created in the last 2 days. Unread topics will show unread counts <span class="badge unread-posts badge-notification">1</span> if you: created the topic, replied to the topic, read the topic for more than 5 minutes, or if you have explicitly set the topic to Tracked or Watched via the πŸ”” in each topic.</p><p>Visit your <a href="%{userPrefsUrl}">preferences</a> to change this.</p>'
bottom:
latest: "There are no more latest topics."
posted: "There are no more posted topics."