From 89ac01704e60abaa328aeb9ff14c555340bffa31 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Thu, 6 Oct 2022 05:15:05 +0800 Subject: [PATCH] DEV: Remove contextual topic list linking behaviour in sidebar (#18485) The feedback we got here is that the contextual topic list link behaviour is surprising and people prefer that the topic list sidebar links always go to a consistent location. Internal ref: /t/74666/16 --- .../everything-section-link.js | 8 +---- .../category-section-link.js | 8 +---- .../community-section/tracked-section-link.js | 8 +---- .../user/tags-section/tag-section-link.js | 8 +---- .../sidebar-user-community-section-test.js | 30 ------------------- 5 files changed, 4 insertions(+), 58 deletions(-) diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/common/community-section/everything-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/common/community-section/everything-section-link.js index ac440559e53..39873ea966f 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/common/community-section/everything-section-link.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/common/community-section/everything-section-link.js @@ -63,13 +63,7 @@ export default class EverythingSectionLink extends BaseSectionLink { } get route() { - if (this.totalUnread > 0) { - return "discovery.unread"; - } else if (this.totalNew > 0) { - return "discovery.new"; - } else { - return "discovery.latest"; - } + return "discovery.latest"; } get prefixValue() { diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/user/categories-section/category-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/user/categories-section/category-section-link.js index 6fa4638dbc9..3fc33ea2dff 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/user/categories-section/category-section-link.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/user/categories-section/category-section-link.js @@ -79,12 +79,6 @@ export default class CategorySectionLink { } get route() { - if (this.totalUnread > 0) { - return "discovery.unreadCategory"; - } else if (this.totalNew > 0) { - return "discovery.newCategory"; - } else { - return "discovery.category"; - } + return "discovery.category"; } } diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/user/community-section/tracked-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/user/community-section/tracked-section-link.js index 110f4265252..de23bee0a2e 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/user/community-section/tracked-section-link.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/user/community-section/tracked-section-link.js @@ -64,13 +64,7 @@ export default class TrackedSectionLink extends BaseSectionLink { } get route() { - if (this.totalUnread > 0) { - return "discovery.unread"; - } else if (this.totalNew > 0) { - return "discovery.new"; - } else { - return "discovery.latest"; - } + return "discovery.latest"; } get prefixValue() { diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/tag-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/tag-section-link.js index 094fe74de26..ed09b6f609b 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/tag-section-link.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/tag-section-link.js @@ -33,13 +33,7 @@ export default class TagSectionLink extends BaseTagSectionLink { } get route() { - if (this.totalUnread > 0) { - return "tag.showUnread"; - } else if (this.totalNew > 0) { - return "tag.showNew"; - } else { - return "tag.show"; - } + return "tag.show"; } get currentWhen() { diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js index d48d92e0d13..4230f0ed932 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js @@ -583,11 +583,6 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) { "it displays the right unread count" ); - assert.ok( - query(".sidebar-section-link-everything").href.endsWith("/unread"), - "it links to unread filter" - ); - // simulate reading topic 2 await publishToMessageBus("/unread", { topic_id: 2, @@ -637,11 +632,6 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) { "it displays the new count once there are no unread topics" ); - assert.ok( - query(".sidebar-section-link-everything").href.endsWith("/new"), - "it links to new filter" - ); - await publishToMessageBus("/unread", { topic_id: 1, message_type: "read", @@ -658,11 +648,6 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) { ), "it removes new count once there are no new topics" ); - - assert.ok( - query(".sidebar-section-link-everything").href.endsWith("/latest"), - "it links to latest filter" - ); }); test("visiting top route with tracked filter", async function (assert) { @@ -871,11 +856,6 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) { "it displays the right unread count" ); - assert.ok( - query(".sidebar-section-link-tracked").href.endsWith("/unread?f=tracked"), - "it links to unread url with tracked filter" - ); - // simulate reading topic id 2 await publishToMessageBus("/unread", { topic_id: 2, @@ -922,11 +902,6 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) { "it displays the new count once there are no tracked unread topics" ); - assert.ok( - query(".sidebar-section-link-tracked").href.endsWith("/new?f=tracked"), - "it links to new url with tracked filter" - ); - // simulate reading topic id 1 await publishToMessageBus("/unread", { topic_id: 1, @@ -943,11 +918,6 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) { ), "it removes new count once there are no tracked new topics" ); - - assert.ok( - query(".sidebar-section-link-tracked").href.endsWith("/latest?f=tracked"), - "it links to latest url with tracked filter" - ); }); test("adding section link via plugin API with Object", async function (assert) {