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]
|
type_filters = type_filters - %i[my owner]
|
||||||
end
|
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)
|
type_filters.delete(:non_automatic)
|
||||||
|
|
||||||
# count the total before doing pagination
|
# count the total before doing pagination
|
||||||
|
|||||||
@ -121,6 +121,11 @@ class CategoryList
|
|||||||
|
|
||||||
@categories = self.class.order_categories(@categories)
|
@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
|
@categories = @categories.to_a
|
||||||
|
|
||||||
include_subcategories = @options[:include_subcategories] == true
|
include_subcategories = @options[:include_subcategories] == true
|
||||||
|
|||||||
@ -71,19 +71,28 @@ class Site
|
|||||||
.cache
|
.cache
|
||||||
.fetch(categories_cache_key, expires_in: 30.minutes) do
|
.fetch(categories_cache_key, expires_in: 30.minutes) do
|
||||||
categories =
|
categories =
|
||||||
Category
|
begin
|
||||||
.includes(
|
query =
|
||||||
:uploaded_logo,
|
Category
|
||||||
:uploaded_logo_dark,
|
.includes(
|
||||||
:uploaded_background,
|
:uploaded_logo,
|
||||||
:tags,
|
:uploaded_logo_dark,
|
||||||
:tag_groups,
|
:uploaded_background,
|
||||||
category_required_tag_groups: :tag_group,
|
:tags,
|
||||||
)
|
:tag_groups,
|
||||||
.joins("LEFT JOIN topics t on t.id = categories.topic_id")
|
category_required_tag_groups: :tag_group,
|
||||||
.select("categories.*, t.slug topic_slug")
|
)
|
||||||
.order(:position)
|
.joins("LEFT JOIN topics t on t.id = categories.topic_id")
|
||||||
.to_a
|
.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?
|
if preloaded_category_custom_fields.present?
|
||||||
Category.preload_custom_fields(categories, preloaded_category_custom_fields)
|
Category.preload_custom_fields(categories, preloaded_category_custom_fields)
|
||||||
|
|||||||
Reference in New Issue
Block a user