mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
DEV: Apply syntax_tree formatting to plugins/*
This commit is contained in:
@ -9,7 +9,10 @@ class Chat::Api::CategoryChatablesController < ApplicationController
|
||||
Group
|
||||
.joins(:category_groups)
|
||||
.where(category_groups: { category_id: category.id })
|
||||
.where("category_groups.permission_type IN (?)", [CategoryGroup.permission_types[:full], CategoryGroup.permission_types[:create_post]])
|
||||
.where(
|
||||
"category_groups.permission_type IN (?)",
|
||||
[CategoryGroup.permission_types[:full], CategoryGroup.permission_types[:create_post]],
|
||||
)
|
||||
.joins("LEFT OUTER JOIN group_users ON groups.id = group_users.group_id")
|
||||
.group("groups.id", "groups.name")
|
||||
.pluck("groups.name", "COUNT(group_users.user_id)")
|
||||
|
@ -9,16 +9,17 @@ class Chat::Api::HintsController < ApplicationController
|
||||
|
||||
raise Discourse::InvalidParameters.new(:mentions) if group_names.blank?
|
||||
|
||||
visible_groups = Group
|
||||
.where("LOWER(name) IN (?)", group_names)
|
||||
.visible_groups(current_user)
|
||||
.pluck(:name)
|
||||
visible_groups =
|
||||
Group.where("LOWER(name) IN (?)", group_names).visible_groups(current_user).pluck(:name)
|
||||
|
||||
mentionable_groups = filter_mentionable_groups(visible_groups)
|
||||
|
||||
result = {
|
||||
unreachable: visible_groups - mentionable_groups.map(&:name),
|
||||
over_members_limit: mentionable_groups.select { |g| g.user_count > SiteSetting.max_users_notified_per_group_mention }.map(&:name),
|
||||
over_members_limit:
|
||||
mentionable_groups
|
||||
.select { |g| g.user_count > SiteSetting.max_users_notified_per_group_mention }
|
||||
.map(&:name),
|
||||
}
|
||||
|
||||
result[:invalid] = (group_names - result[:unreachable]) - result[:over_members_limit]
|
||||
|
Reference in New Issue
Block a user