FIX: Ensure 'untagged' document title is set correctly (#24689)
https://meta.discourse.org/t/286130/4
This commit is contained in:
parent
7196613e2e
commit
9479b30ada
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in New Issue