Compare commits
2 Commits
main
...
dev/circle
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1c3dfc8f5 | ||
|
|
5fb655b6bf |
@ -80,6 +80,11 @@ class GroupsController < ApplicationController
|
||||
type_filters = type_filters - %i[my owner]
|
||||
end
|
||||
|
||||
modifiers = []
|
||||
# some plugins may need to change the query
|
||||
DiscourseEvent.trigger(:query_groups_list, modifiers, groups, @guardian, params)
|
||||
modifiers.each { |mod| groups = mod.call(groups) }
|
||||
|
||||
type_filters.delete(:non_automatic)
|
||||
|
||||
# count the total before doing pagination
|
||||
|
||||
@ -121,6 +121,11 @@ class CategoryList
|
||||
|
||||
@categories = self.class.order_categories(@categories)
|
||||
|
||||
modifiers = []
|
||||
# some plugins may need to change the categories cached on site load
|
||||
DiscourseEvent.trigger(:query_categories_list, modifiers, @categories, @guardian, @options)
|
||||
modifiers.each { |mod| @categories = mod.call(@categories) }
|
||||
|
||||
@categories = @categories.to_a
|
||||
|
||||
include_subcategories = @options[:include_subcategories] == true
|
||||
|
||||
@ -71,19 +71,28 @@ class Site
|
||||
.cache
|
||||
.fetch(categories_cache_key, expires_in: 30.minutes) do
|
||||
categories =
|
||||
Category
|
||||
.includes(
|
||||
:uploaded_logo,
|
||||
:uploaded_logo_dark,
|
||||
:uploaded_background,
|
||||
:tags,
|
||||
:tag_groups,
|
||||
category_required_tag_groups: :tag_group,
|
||||
)
|
||||
.joins("LEFT JOIN topics t on t.id = categories.topic_id")
|
||||
.select("categories.*, t.slug topic_slug")
|
||||
.order(:position)
|
||||
.to_a
|
||||
begin
|
||||
query =
|
||||
Category
|
||||
.includes(
|
||||
:uploaded_logo,
|
||||
:uploaded_logo_dark,
|
||||
:uploaded_background,
|
||||
:tags,
|
||||
:tag_groups,
|
||||
category_required_tag_groups: :tag_group,
|
||||
)
|
||||
.joins("LEFT JOIN topics t on t.id = categories.topic_id")
|
||||
.select("categories.*, t.slug topic_slug")
|
||||
.order(:position)
|
||||
|
||||
modifiers = []
|
||||
# some plugins may need to change the categories cached on site load
|
||||
DiscourseEvent.trigger(:site_query_categories, modifiers, query, @guardian)
|
||||
modifiers.each { |mod| query = mod.call(query) }
|
||||
|
||||
query.to_a
|
||||
end
|
||||
|
||||
if preloaded_category_custom_fields.present?
|
||||
Category.preload_custom_fields(categories, preloaded_category_custom_fields)
|
||||
|
||||
Reference in New Issue
Block a user