<% end %>
diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb
index 3a2c86bd2f9..5315bddaf67 100644
--- a/app/views/topics/show.html.erb
+++ b/app/views/topics/show.html.erb
@@ -26,7 +26,7 @@
<% @tags.each_with_index do |tag, i| %>
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 7b42b1a387f..661bd4b008d 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2587,7 +2587,7 @@ en:
- Upgrade using our easy **[one-click browser upgrade](%{base_url}/admin/upgrade)**
- - See what's new in the [release notes](https://meta.discourse.org/tags/release-notes) or view the [raw GitHub changelog](https://github.com/discourse/discourse/commits/master)
+ - See what's new in the [release notes](https://meta.discourse.org/tag/release-notes) or view the [raw GitHub changelog](https://github.com/discourse/discourse/commits/master)
- Visit [meta.discourse.org](https://meta.discourse.org) for news, discussion, and support for Discourse
@@ -2602,7 +2602,7 @@ en:
- Upgrade using our easy **[one-click browser upgrade](%{base_url}/admin/upgrade)**
- - See what's new in the [release notes](https://meta.discourse.org/tags/release-notes) or view the [raw GitHub changelog](https://github.com/discourse/discourse/commits/master)
+ - See what's new in the [release notes](https://meta.discourse.org/tag/release-notes) or view the [raw GitHub changelog](https://github.com/discourse/discourse/commits/master)
- Visit [meta.discourse.org](https://meta.discourse.org) for news, discussion, and support for Discourse
diff --git a/config/routes.rb b/config/routes.rb
index 61fadd76d76..039f2008fdd 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -847,7 +847,7 @@ Discourse::Application.routes.draw do
scope '/tag/:tag_id' do
constraints format: :json do
- get '/' => 'tags#show'
+ get '/' => 'tags#show', as: 'tag_show'
get '/info' => 'tags#info'
get '/notifications' => 'tags#notifications'
put '/notifications' => 'tags#update_notifications'
@@ -857,7 +857,7 @@ Discourse::Application.routes.draw do
delete '/synonyms/:synonym_id' => 'tags#destroy_synonym'
Discourse.filters.each do |filter|
- get "/l/#{filter}" => "tags#show_#{filter}"
+ get "/l/#{filter}" => "tags#show_#{filter}", as: "tag_show_#{filter}"
end
end
@@ -897,7 +897,7 @@ Discourse::Application.routes.draw do
# legacy routes
constraints(tag_id: /[^\/]+?/, format: /json|rss/) do
get '/:tag_id.rss' => 'tags#tag_feed'
- get '/:tag_id' => 'tags#show', as: 'tag_show'
+ get '/:tag_id' => 'tags#show'
get '/:tag_id/info' => 'tags#info'
get '/:tag_id/notifications' => 'tags#notifications'
put '/:tag_id/notifications' => 'tags#update_notifications'
@@ -907,7 +907,7 @@ Discourse::Application.routes.draw do
delete '/:tag_id/synonyms/:synonym_id' => 'tags#destroy_synonym'
Discourse.filters.each do |filter|
- get "/:tag_id/l/#{filter}" => "tags#show_#{filter}", as: "tag_show_#{filter}"
+ get "/:tag_id/l/#{filter}" => "tags#show_#{filter}"
end
end
end
diff --git a/lib/pretty_text/helpers.rb b/lib/pretty_text/helpers.rb
index eac9384afb1..975c104fba1 100644
--- a/lib/pretty_text/helpers.rb
+++ b/lib/pretty_text/helpers.rb
@@ -113,7 +113,7 @@ module PrettyText
[category.url_with_id, text]
elsif (!is_tag && tag = Tag.find_by(name: text)) ||
(is_tag && tag = Tag.find_by(name: text.gsub!("#{tag_postfix}", '')))
- ["#{Discourse.base_url}/tags/#{tag.name}", text]
+ ["#{Discourse.base_url}/tag/#{tag.name}", text]
else
nil
end
diff --git a/spec/components/pretty_text_spec.rb b/spec/components/pretty_text_spec.rb
index 4beb8cfc473..8f2c16e57f3 100644
--- a/spec/components/pretty_text_spec.rb
+++ b/spec/components/pretty_text_spec.rb
@@ -1056,7 +1056,7 @@ describe PrettyText do
[
"
#unknown::tag",
"
#known",
- "
#known",
+ "
#known",
"
#testing"
].each do |element|
@@ -1077,7 +1077,7 @@ describe PrettyText do
cooked = PrettyText.cook("
test #known::tag")
html = <<~HTML
-
test #known
+
test #known
HTML
expect(cooked).to eq(html.strip)
diff --git a/spec/requests/tags_controller_spec.rb b/spec/requests/tags_controller_spec.rb
index 5d20f9025bc..f750e03116d 100644
--- a/spec/requests/tags_controller_spec.rb
+++ b/spec/requests/tags_controller_spec.rb
@@ -82,30 +82,30 @@ describe TagsController do
fab!(:tag) { Fabricate(:tag, name: 'test') }
it "should return the right response" do
- get "/tags/test"
+ get "/tag/test"
expect(response.status).to eq(200)
end
it "should handle invalid tags" do
- get "/tags/%2ftest%2f"
+ get "/tag/%2ftest%2f"
expect(response.status).to eq(404)
end
it "should handle synonyms" do
synonym = Fabricate(:tag, target_tag: tag)
- get "/tags/#{synonym.name}"
+ get "/tag/#{synonym.name}"
expect(response.status).to eq(200)
end
it "does not show staff-only tags" do
tag_group = Fabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: ["test"])
- get "/tags/test"
+ get "/tag/test"
expect(response.status).to eq(404)
sign_in(admin)
- get "/tags/test"
+ get "/tag/test"
expect(response.status).to eq(200)
end
@@ -181,12 +181,12 @@ describe TagsController do
let(:synonym) { Fabricate(:tag, name: 'synonym', target_tag: tag) }
it "returns 404 if tag not found" do
- get "/tags/nope/info.json"
+ get "/tag/nope/info.json"
expect(response.status).to eq(404)
end
it "can handle tag with no synonyms" do
- get "/tags/#{tag.name}/info.json"
+ get "/tag/#{tag.name}/info.json"
expect(response.status).to eq(200)
expect(json.dig('tag_info', 'name')).to eq(tag.name)
expect(json.dig('tag_info', 'synonyms')).to be_empty
@@ -194,7 +194,7 @@ describe TagsController do
end
it "can handle a synonym" do
- get "/tags/#{synonym.name}/info.json"
+ get "/tag/#{synonym.name}/info.json"
expect(response.status).to eq(200)
expect(json.dig('tag_info', 'name')).to eq(synonym.name)
expect(json.dig('tag_info', 'synonyms')).to be_empty
@@ -203,21 +203,21 @@ describe TagsController do
it "can return a tag's synonyms" do
synonym
- get "/tags/#{tag.name}/info.json"
+ get "/tag/#{tag.name}/info.json"
expect(response.status).to eq(200)
expect(json.dig('tag_info', 'synonyms').map { |t| t['text'] }).to eq([synonym.name])
end
it "returns 404 if tag is staff-only" do
tag_group = Fabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: ["test"])
- get "/tags/test/info.json"
+ get "/tag/test/info.json"
expect(response.status).to eq(404)
end
it "staff-only tags can be retrieved for staff user" do
sign_in(admin)
tag_group = Fabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: ["test"])
- get "/tags/test/info.json"
+ get "/tag/test/info.json"
expect(response.status).to eq(200)
end
@@ -227,7 +227,7 @@ describe TagsController do
tag_group = Fabricate(:tag_group, tags: [tag])
category2.update!(tag_groups: [tag_group])
staff_category = Fabricate(:private_category, group: Fabricate(:group), tags: [tag])
- get "/tags/#{tag.name}/info.json"
+ get "/tag/#{tag.name}/info.json"
expect(json.dig('tag_info', 'category_ids')).to contain_exactly(category.id, category2.id)
expect(json['categories']).to be_present
end
@@ -237,13 +237,13 @@ describe TagsController do
it "returns tag groups if tag groups are visible" do
SiteSetting.tags_listed_by_group = true
- get "/tags/#{tag.name}/info.json"
+ get "/tag/#{tag.name}/info.json"
expect(json.dig('tag_info', 'tag_group_names')).to eq([tag_group.name])
end
it "doesn't return tag groups if tag groups aren't visible" do
SiteSetting.tags_listed_by_group = false
- get "/tags/#{tag.name}/info.json"
+ get "/tag/#{tag.name}/info.json"
expect(json['tag_info'].has_key?('tag_group_names')).to eq(false)
end
end
@@ -272,7 +272,7 @@ describe TagsController do
it "triggers a extensibility event" do
event = DiscourseEvent.track_events {
- put "/tags/#{tag.name}.json", params: {
+ put "/tag/#{tag.name}.json", params: {
tag: {
id: 'hello'
}
@@ -365,7 +365,7 @@ describe TagsController do
context 'tagging disabled' do
it "returns 404" do
SiteSetting.tagging_enabled = false
- get "/tags/#{tag.name}/l/latest.json"
+ get "/tag/#{tag.name}/l/latest.json"
expect(response.status).to eq(404)
end
end
@@ -377,14 +377,14 @@ describe TagsController do
end
it "can filter by tag" do
- get "/tags/#{tag.name}/l/latest.json"
+ get "/tag/#{tag.name}/l/latest.json"
expect(response.status).to eq(200)
end
it "can filter by two tags" do
single_tag_topic; multi_tag_topic; all_tag_topic
- get "/tags/#{tag.name}/l/latest.json", params: {
+ get "/tag/#{tag.name}/l/latest.json", params: {
additional_tag_ids: other_tag.name
}
@@ -399,7 +399,7 @@ describe TagsController do
it "can filter by multiple tags" do
single_tag_topic; multi_tag_topic; all_tag_topic
- get "/tags/#{tag.name}/l/latest.json", params: {
+ get "/tag/#{tag.name}/l/latest.json", params: {
additional_tag_ids: "#{other_tag.name}/#{third_tag.name}"
}
@@ -414,7 +414,7 @@ describe TagsController do
it "does not find any tags when a tag which doesn't exist is passed" do
single_tag_topic
- get "/tags/#{tag.name}/l/latest.json", params: {
+ get "/tag/#{tag.name}/l/latest.json", params: {
additional_tag_ids: "notatag"
}
@@ -462,7 +462,7 @@ describe TagsController do
end
it "can filter by bookmarked" do
- get "/tags/#{tag.name}/l/bookmarks.json"
+ get "/tag/#{tag.name}/l/bookmarks.json"
expect(response.status).to eq(200)
end
@@ -479,7 +479,7 @@ describe TagsController do
it "includes topics when filtered by muted tag" do
single_tag_topic
- get "/tags/#{tag.name}/l/latest.json"
+ get "/tag/#{tag.name}/l/latest.json"
expect(response.status).to eq(200)
topic_ids = parse_topic_ids
@@ -642,7 +642,7 @@ describe TagsController do
context 'with an existent tag name' do
it 'deletes the tag' do
tag = Fabricate(:tag)
- delete "/tags/#{tag.name}.json"
+ delete "/tag/#{tag.name}.json"
expect(response.status).to eq(200)
expect(Tag.where(id: tag.id)).to be_empty
end
@@ -650,7 +650,7 @@ describe TagsController do
context 'with a nonexistent tag name' do
it 'returns a tag not found message' do
- delete "/tags/doesntexists.json"
+ delete "/tag/doesntexists.json"
expect(response).not_to be_successful
expect(json['error_type']).to eq('not_found')
end
@@ -746,13 +746,13 @@ describe TagsController do
fab!(:tag) { Fabricate(:tag) }
it 'fails if not logged in' do
- post "/tags/#{tag.name}/synonyms.json", params: { synonyms: ['synonym1'] }
+ post "/tag/#{tag.name}/synonyms.json", params: { synonyms: ['synonym1'] }
expect(response.status).to eq(403)
end
it 'fails if not staff user' do
sign_in(user)
- post "/tags/#{tag.name}/synonyms.json", params: { synonyms: ['synonym1'] }
+ post "/tag/#{tag.name}/synonyms.json", params: { synonyms: ['synonym1'] }
expect(response.status).to eq(403)
end
@@ -762,7 +762,7 @@ describe TagsController do
it 'can make a tag a synonym of another tag' do
tag2 = Fabricate(:tag)
expect {
- post "/tags/#{tag.name}/synonyms.json", params: { synonyms: [tag2.name] }
+ post "/tag/#{tag.name}/synonyms.json", params: { synonyms: [tag2.name] }
}.to_not change { Tag.count }
expect(response.status).to eq(200)
expect(tag2.reload.target_tag).to eq(tag)
@@ -770,7 +770,7 @@ describe TagsController do
it 'can create new tags at the same time' do
expect {
- post "/tags/#{tag.name}/synonyms.json", params: { synonyms: ['synonym'] }
+ post "/tag/#{tag.name}/synonyms.json", params: { synonyms: ['synonym'] }
}.to change { Tag.count }.by(1)
expect(response.status).to eq(200)
expect(Tag.find_by_name('synonym')&.target_tag).to eq(tag)
@@ -779,7 +779,7 @@ describe TagsController do
it 'can return errors' do
tag2 = Fabricate(:tag, target_tag: tag)
tag3 = Fabricate(:tag)
- post "/tags/#{tag3.name}/synonyms.json", params: { synonyms: [tag.name] }
+ post "/tag/#{tag3.name}/synonyms.json", params: { synonyms: [tag.name] }
expect(response.status).to eq(200)
json = JSON.parse(response.body)
expect(json['failed']).to be_present
@@ -791,7 +791,7 @@ describe TagsController do
describe '#destroy_synonym' do
fab!(:tag) { Fabricate(:tag) }
fab!(:synonym) { Fabricate(:tag, target_tag: tag, name: 'synonym') }
- subject { delete("/tags/#{tag.name}/synonyms/#{synonym.name}.json") }
+ subject { delete("/tag/#{tag.name}/synonyms/#{synonym.name}.json") }
it 'fails if not logged in' do
subject
@@ -815,13 +815,13 @@ describe TagsController do
end
it "returns error if tag isn't a synonym" do
- delete "/tags/#{Fabricate(:tag).name}/synonyms/#{synonym.name}.json"
+ delete "/tag/#{Fabricate(:tag).name}/synonyms/#{synonym.name}.json"
expect(response.status).to eq(400)
expect_same_tag_names(tag.reload.synonyms, [synonym])
end
it "returns error if synonym not found" do
- delete "/tags/#{Fabricate(:tag).name}/synonyms/nope.json"
+ delete "/tag/#{Fabricate(:tag).name}/synonyms/nope.json"
expect(response.status).to eq(404)
expect_same_tag_names(tag.reload.synonyms, [synonym])
end
diff --git a/test/javascripts/acceptance/search-test.js.es6 b/test/javascripts/acceptance/search-test.js.es6
index 2aa186de2b0..1b930c7905f 100644
--- a/test/javascripts/acceptance/search-test.js.es6
+++ b/test/javascripts/acceptance/search-test.js.es6
@@ -50,7 +50,7 @@ QUnit.test("search for a tag", async assert => {
});
QUnit.test("search scope checkbox", async assert => {
- await visit("/tags/important");
+ await visit("/tag/important");
await click("#search-button");
assert.ok(
exists(".search-context input:checked"),
diff --git a/test/javascripts/acceptance/tag-hashtag-test.js.es6 b/test/javascripts/acceptance/tag-hashtag-test.js.es6
index b640d2cb97b..4a28ca137dd 100644
--- a/test/javascripts/acceptance/tag-hashtag-test.js.es6
+++ b/test/javascripts/acceptance/tag-hashtag-test.js.es6
@@ -6,7 +6,7 @@ acceptance("Tag Hashtag", {
pretend(server, helper) {
server.get("/tags/check", () => {
return helper.response({
- valid: [{ value: "monkey", url: "/tags/monkey" }]
+ valid: [{ value: "monkey", url: "/tag/monkey" }]
});
});
}
@@ -22,6 +22,6 @@ QUnit.test("tag is cooked properly", async assert => {
find(".d-editor-preview:visible")
.html()
.trim(),
- '
this is a tag hashtag #monkey
'
+ '
this is a tag hashtag #monkey
'
);
});
diff --git a/test/javascripts/acceptance/tags-intersection-test.js.es6 b/test/javascripts/acceptance/tags-intersection-test.js.es6
index 1025266e484..e768f438b77 100644
--- a/test/javascripts/acceptance/tags-intersection-test.js.es6
+++ b/test/javascripts/acceptance/tags-intersection-test.js.es6
@@ -5,7 +5,7 @@ acceptance("Tags intersection", {
site: { can_tag_topics: true },
settings: { tagging_enabled: true },
pretend(server, helper) {
- server.get("/tags/first/notifications", () => {
+ server.get("/tag/first/notifications", () => {
return helper.response({
tag_notification: { id: "first", notification_level: 1 }
});
diff --git a/test/javascripts/acceptance/tags-test.js.es6 b/test/javascripts/acceptance/tags-test.js.es6
index cbab7d821af..276c814a914 100644
--- a/test/javascripts/acceptance/tags-test.js.es6
+++ b/test/javascripts/acceptance/tags-test.js.es6
@@ -91,7 +91,7 @@ QUnit.test("list the tags in groups", async assert => {
.map(i => {
return $(i).attr("href");
}),
- ["/tags/focus", "/tags/escort"],
+ ["/tag/focus", "/tag/escort"],
"always uses lowercase URLs for mixed case tags"
);
assert.equal(
@@ -103,13 +103,13 @@ QUnit.test("list the tags in groups", async assert => {
test("new topic button is not available for staff-only tags", async assert => {
/* global server */
- server.get("/tags/regular-tag/notifications", () => [
+ server.get("/tag/regular-tag/notifications", () => [
200,
{ "Content-Type": "application/json" },
{ tag_notification: { id: "regular-tag", notification_level: 1 } }
]);
- server.get("/tags/regular-tag/l/latest.json", () => [
+ server.get("/tag/regular-tag/l/latest.json", () => [
200,
{ "Content-Type": "application/json" },
{
@@ -133,13 +133,13 @@ test("new topic button is not available for staff-only tags", async assert => {
}
]);
- server.get("/tags/staff-only-tag/notifications", () => [
+ server.get("/tag/staff-only-tag/notifications", () => [
200,
{ "Content-Type": "application/json" },
{ tag_notification: { id: "staff-only-tag", notification_level: 1 } }
]);
- server.get("/tags/staff-only-tag/l/latest.json", () => [
+ server.get("/tag/staff-only-tag/l/latest.json", () => [
200,
{ "Content-Type": "application/json" },
{
@@ -166,18 +166,18 @@ test("new topic button is not available for staff-only tags", async assert => {
updateCurrentUser({ moderator: false, admin: false });
- await visit("/tags/regular-tag");
+ await visit("/tag/regular-tag");
assert.ok(find("#create-topic:disabled").length === 0);
- await visit("/tags/staff-only-tag");
+ await visit("/tag/staff-only-tag");
assert.ok(find("#create-topic:disabled").length === 1);
updateCurrentUser({ moderator: true });
- await visit("/tags/regular-tag");
+ await visit("/tag/regular-tag");
assert.ok(find("#create-topic:disabled").length === 0);
- await visit("/tags/staff-only-tag");
+ await visit("/tag/staff-only-tag");
assert.ok(find("#create-topic:disabled").length === 0);
});
@@ -187,13 +187,13 @@ acceptance("Tag info", {
tags_listed_by_group: true
},
pretend(server, helper) {
- server.get("/tags/planters/notifications", () => {
+ server.get("/tag/planters/notifications", () => {
return helper.response({
tag_notification: { id: "planters", notification_level: 1 }
});
});
- server.get("/tags/planters/l/latest.json", () => {
+ server.get("/tag/planters/l/latest.json", () => {
return helper.response({
users: [],
primary_groups: [],
@@ -215,7 +215,7 @@ acceptance("Tag info", {
});
});
- server.get("/tags/planters/info", () => {
+ server.get("/tag/planters/info", () => {
return helper.response({
__rest_serializer: "1",
tag_info: {
@@ -261,7 +261,7 @@ acceptance("Tag info", {
test("tag info can show synonyms", async assert => {
updateCurrentUser({ moderator: false, admin: false });
- await visit("/tags/planters");
+ await visit("/tag/planters");
assert.ok(find("#show-tag-info").length === 1);
await click("#show-tag-info");
@@ -286,7 +286,7 @@ test("tag info can show synonyms", async assert => {
});
test("admin can manage tags", async assert => {
- server.delete("/tags/planters/synonyms/containers", () => [
+ server.delete("/tag/planters/synonyms/containers", () => [
200,
{ "Content-Type": "application/json" },
{ success: true }
@@ -294,7 +294,7 @@ test("admin can manage tags", async assert => {
updateCurrentUser({ moderator: false, admin: true });
- await visit("/tags/planters");
+ await visit("/tag/planters");
assert.ok(find("#show-tag-info").length === 1);
await click("#show-tag-info");
diff --git a/test/javascripts/components/tag-drop-test.js.es6 b/test/javascripts/components/tag-drop-test.js.es6
index c457ec71f44..57f8f755228 100644
--- a/test/javascripts/components/tag-drop-test.js.es6
+++ b/test/javascripts/components/tag-drop-test.js.es6
@@ -71,7 +71,7 @@ componentTest("default", {
await this.subject.fillInFilter("dav");
await this.subject.keyboard("enter");
assert.ok(
- DiscourseURL.routeTo.calledWith("/tags/david"),
+ DiscourseURL.routeTo.calledWith("/tag/david"),
"it uses lowercase URLs for tags"
);
}
@@ -107,7 +107,7 @@ componentTest("synonym", {
await this.subject.fillInFilter("robin");
await this.subject.keyboard("enter");
assert.ok(
- DiscourseURL.routeTo.calledWith("/tags/eviltrout"),
+ DiscourseURL.routeTo.calledWith("/tag/eviltrout"),
"it routes to the target tag"
);
}
diff --git a/test/javascripts/fixtures/discovery_fixtures.js.es6 b/test/javascripts/fixtures/discovery_fixtures.js.es6
index 03863bf964e..01228b94370 100644
--- a/test/javascripts/fixtures/discovery_fixtures.js.es6
+++ b/test/javascripts/fixtures/discovery_fixtures.js.es6
@@ -3756,7 +3756,7 @@ export default {
]
}
},
- "/tags/important/l/latest.json": {
+ "/tag/important/l/latest.json": {
users: [{ id: 1, username: "sam", avatar_template: "/images/avatar.png" }],
primary_groups: [],
topic_list: {