A platform for community discussion. Free, open, simple.
FIX: Ensure staff can see /tag/none (#11208)
Dan Ungureanu74a118c13a09
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rbindex bc2e5c106b2..ea4909f38fc 100644--- a/app/controllers/tags_controller.rb+++ b/app/controllers/tags_controller.rb@@ -453,6 +453,7 @@ class TagsController < ::ApplicationControlleroptions[:no_subcategories] = true if params[:no_subcategories] == 'true'if params[:tag_id] == 'none'+ options.delete(:tags)options[:no_tags] = trueelseoptions[:tags] = tag_paramsdiff --git a/spec/requests/tags_controller_spec.rb b/spec/requests/tags_controller_spec.rbindex 15ad2d9b119..ffcbe86a3a3 100644--- a/spec/requests/tags_controller_spec.rb+++ b/spec/requests/tags_controller_spec.rb@@ -123,6 +123,8 @@ describe TagsController dodescribe '#show' dofab!(:tag) { Fabricate(:tag, name: 'test') }+ fab!(:topic_without_tags) { Fabricate(:topic) }+ fab!(:topic_with_tags) { Fabricate(:topic, tags: [tag]) }it "should return the right response" doget "/tag/test.json"@@ -162,6 +164,15 @@ describe TagsController doexpect(response.status).to eq(200)end+ it "handles special tag 'none'" do+ SiteSetting.allow_staff_to_tag_pms = true++ sign_in(admin)++ get "/tag/none.json"+ expect(response.parsed_body['topic_list']['topics'].length).to eq(1)+ end+context "with a category in the path" dofab!(:topic_in_category) {Fabricate(