mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: exclude topics from latest in /categories on refresh
When you hit refresh on categories page it would not supress correctly
This commit is contained in:
parent
fd14ee4797
commit
146a6c3592
@ -42,7 +42,8 @@ class CategoriesController < ApplicationController
|
||||
style = SiteSetting.desktop_category_page_style
|
||||
topic_options = {
|
||||
per_page: SiteSetting.categories_topics,
|
||||
no_definitions: true
|
||||
no_definitions: true,
|
||||
exclude_category_ids: Category.where(suppress_from_latest: true).pluck(:id)
|
||||
}
|
||||
|
||||
if style == "categories_and_latest_topics".freeze
|
||||
|
@ -1,6 +1,23 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe GroupsController do
|
||||
describe CategoriesController do
|
||||
|
||||
context 'index' do
|
||||
|
||||
it 'suppresses categories correctly' do
|
||||
post = create_post(title: 'super AMAZING AMAZING post')
|
||||
|
||||
get "/categories"
|
||||
expect(response.body).to include('AMAZING AMAZING')
|
||||
|
||||
post.topic.category.update_columns(suppress_from_latest: true)
|
||||
|
||||
get "/categories"
|
||||
expect(response.body).not_to include('AMAZING AMAZING')
|
||||
end
|
||||
end
|
||||
|
||||
context 'extensibility event' do
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
let(:category) { Fabricate(:category, user: admin) }
|
||||
|
||||
@ -22,3 +39,4 @@ describe GroupsController do
|
||||
expect(event[:params].first).to eq(category)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user