A platform for community discussion. Free, open, simple.
FIX: Ensure 'untagged' document title is set correctly (#24689)
David Taylor9479b30ada8a
diff --git a/app/assets/javascripts/discourse/app/routes/tag-show.js b/app/assets/javascripts/discourse/app/routes/tag-show.jsindex 19926a8ffd5..5617752041c 100644--- a/app/assets/javascripts/discourse/app/routes/tag-show.js+++ b/app/assets/javascripts/discourse/app/routes/tag-show.js@@ -173,7 +173,8 @@ export default class TagShowRoute extends DiscourseRoute {);const model = this.currentModel;- if (model?.tag?.id) {+ const tag = model?.tag?.id;+ if (tag && tag !== NONE) {if (model.category) {return I18n.t("tagging.filters.with_category", {filter: filterText,diff --git a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/tags-test.jsindex 83e514e0296..fe78828c695 100644--- a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/tags-test.js@@ -10,6 +10,7 @@ import {updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";+import I18n from "discourse-i18n";acceptance("Tags", function (needs) {needs.user();@@ -310,6 +311,21 @@ acceptance("Tag info", function (needs) {});});+ server.get("/tags/c/feature/2/none/l/latest.json", () => {+ return helper.response({+ users: [],+ primary_groups: [],+ topic_list: {+ can_create_topic: true,+ draft: null,+ draft_key: "new_topic",+ draft_sequence: 1,+ per_page: 30,+ topics: [],+ },+ });+ });+server.get("/tag/planters/info", () => {return helper.response({__rest_serializer: "1",@@ -509,6 +525,40 @@ acceptance("Tag info", function (needs) {assert.strictEqual(currentURL(), "/tags/c/feature/2/none/planters");});+ test("sets document title correctly", async function (assert) {+ await visit("/tag/planters");+ assert.strictEqual(+ document.title,+ I18n.t("tagging.filters.without_category", {+ filter: "Latest",+ tag: "planters",+ }) + ` - ${this.siteSettings.title}`+ );++ await click(".category-breadcrumb .category-drop-header");+ await click(`.category-breadcrumb .category-row[data-name="feature"]`);+ assert.strictEqual(currentURL(), "/tags/c/feature/2/planters");+ assert.strictEqual(+ document.title,+ I18n.t("tagging.filters.with_category", {+ filter: "Latest",+ tag: "planters",+ category: "feature",+ }) + ` - ${this.siteSettings.title}`+ );++ await click(".tag-drop-header");+ await click(`.tag-row[data-value="no-tags"]`);+ assert.strictEqual(currentURL(), "/tags/c/feature/2/none");+ assert.strictEqual(+ document.title,+ I18n.t("tagging.filters.untagged_with_category", {+ filter: "Latest",+ category: "feature",+ }) + ` - ${this.siteSettings.title}`+ );+ });+test("can visit show-category-latest routes", async function (assert) {await visit("/tags/c/feature/2/planters");