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

This commit is contained in:
Robin Ward 2021-03-17 13:02:32 -04:00 committed by GitHub
parent 11e6e9cca2
commit 52859bdeab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -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]

View File

@ -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