Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .discourse-compatibility
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
< 2025.12.0-latest: 9bca25f668deeec39c7096c15779e54af5a66ff1
< 3.6.0.beta1-dev: f3249a84e2857ba7312888566d1fd8e4aa35f0cd
< 3.5.0.beta5-dev: 858687bdd6438fa8f638b5048dd1999c89277fe7
< 3.5.0.beta3-dev: fcb4a13c4b5a1b340de3d60f6b4a0d0a1bf37bbc
Expand Down
18 changes: 9 additions & 9 deletions javascripts/discourse/services/topic-thumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ export default class TopicThumbnailService extends Service {
}

@dependentKeyCompat
get viewingTagId() {
return this.discovery.tag?.id;
get viewingTagName() {
return this.discovery.tag?.name;
}

@discourseComputed(
"viewingCategoryId",
"viewingTagId",
"viewingTagName",
"router.currentRoute.metadata.customThumbnailMode",
"isTopicListRoute",
"isTopicRoute",
"isDocsRoute"
)
displayMode(
viewingCategoryId,
viewingTagId,
viewingTagName,
customThumbnailMode,
isTopicListRoute,
isTopicRoute,
Expand All @@ -90,15 +90,15 @@ export default class TopicThumbnailService extends Service {
return "grid";
} else if (listCategories.includes(viewingCategoryId)) {
return "list";
} else if (masonryTags.includes(viewingTagId)) {
} else if (masonryTags.includes(viewingTagName)) {
return "masonry";
} else if (minimalGridTags.includes(viewingTagId)) {
} else if (minimalGridTags.includes(viewingTagName)) {
return "minimal-grid";
} else if (blogStyleTags.includes(viewingTagId)) {
} else if (blogStyleTags.includes(viewingTagName)) {
return "blog-style";
} else if (gridTags.includes(viewingTagId)) {
} else if (gridTags.includes(viewingTagName)) {
return "grid";
} else if (listTags.includes(viewingTagId)) {
} else if (listTags.includes(viewingTagName)) {
return "list";
} else if (isTopicRoute && settings.suggested_topics_mode) {
return settings.suggested_topics_mode;
Expand Down
32 changes: 32 additions & 0 deletions test/acceptance/tag-thumbnail-mode-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { getOwner } from "@ember/owner";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { cloneJSON } from "discourse/lib/object";
import discoveryFixture from "discourse/tests/fixtures/discovery-fixtures";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

acceptance("topic thumbnails | tag route integration", function (needs) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤩

needs.settings({ tagging_enabled: true });

needs.pretender((server, helper) => {
server.get("/tag/important/l/latest.json", () => {
return helper.response(
cloneJSON(discoveryFixture["/tag/important/l/latest.json"])
);
});
});

test("service correctly identifies tag name from route", async function (assert) {
await visit("/tag/important");

const topicThumbnailsService = getOwner(this).lookup(
"service:topic-thumbnails"
);

assert.strictEqual(
topicThumbnailsService.viewingTagName,
"important",
"viewingTagName returns the tag name (not id) from the route"
);
});
});