Skip to content

A platform for community discussion. Free, open, simple.

FIX: Viewing some tag routes wasn't rendering the list without JS (#12344)

Robin Ward52859bdeab6d
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 2c8539026e7..e56274d20f5 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -7,16 +7,20 @@ class TagsController < ::ApplicationController
before_action :ensure_tags_enabled
before_action :ensure_visible, only: [:show, :info]
+ def self.show_methods
+ Discourse.anonymous_filters.map { |f| :"show_#{f}" }
+ end
+
requires_login except: [
:index,
:show,
:tag_feed,
:search,
:info,
- Discourse.anonymous_filters.map { |f| :"show_#{f}" }
- ].flatten
+ *show_methods
+ ]
- skip_before_action :check_xhr, only: [:tag_feed, :show, :index]
+ skip_before_action :check_xhr, only: [:tag_feed, :show, :index, *show_methods]
before_action :set_category, except: [:index, :update, :destroy,
:tag_feed, :search, :notifications, :update_notifications, :personal_messages, :info]
diff --git a/spec/requests/tags_controller_spec.rb b/spec/requests/tags_controller_spec.rb
index bc7677abd0c..cecb8a487ab 100644
--- a/spec/requests/tags_controller_spec.rb
+++ b/spec/requests/tags_controller_spec.rb
@@ -554,6 +554,12 @@ describe TagsController do
expect(response.status).to eq(200)
end
+ it "can render a topic list from the latest endpoint" do
+ get "/tag/#{tag.name}/l/latest"
+ expect(response.status).to eq(200)
+ expect(response.body).to include("topic-list")
+ end
+
it "can filter by two tags" do
single_tag_topic; multi_tag_topic; all_tag_topic