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
This commit is contained in:
Alan Guo Xiang Tan 2022-10-06 05:15:05 +08:00 committed by GitHub
parent 4d8011032e
commit 89ac01704e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 58 deletions

View File

@ -63,14 +63,8 @@ export default class EverythingSectionLink extends BaseSectionLink {
} }
get route() { 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() { get prefixValue() {
return "layer-group"; return "layer-group";

View File

@ -79,12 +79,6 @@ export default class CategorySectionLink {
} }
get route() { get route() {
if (this.totalUnread > 0) {
return "discovery.unreadCategory";
} else if (this.totalNew > 0) {
return "discovery.newCategory";
} else {
return "discovery.category"; return "discovery.category";
} }
} }
}

View File

@ -64,14 +64,8 @@ export default class TrackedSectionLink extends BaseSectionLink {
} }
get route() { 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() { get prefixValue() {
return "bell"; return "bell";

View File

@ -33,14 +33,8 @@ export default class TagSectionLink extends BaseTagSectionLink {
} }
get route() { 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() { get currentWhen() {
return "tag.show tag.showNew tag.showUnread tag.showTop"; return "tag.show tag.showNew tag.showUnread tag.showTop";

View File

@ -583,11 +583,6 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
"it displays the right unread count" "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 // simulate reading topic 2
await publishToMessageBus("/unread", { await publishToMessageBus("/unread", {
topic_id: 2, 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" "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", { await publishToMessageBus("/unread", {
topic_id: 1, topic_id: 1,
message_type: "read", 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" "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) { 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" "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 // simulate reading topic id 2
await publishToMessageBus("/unread", { await publishToMessageBus("/unread", {
topic_id: 2, 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" "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 // simulate reading topic id 1
await publishToMessageBus("/unread", { await publishToMessageBus("/unread", {
topic_id: 1, 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" "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) { test("adding section link via plugin API with Object", async function (assert) {