mirror of
https://github.com/discourse/discourse.git
synced 2025-06-24 17:35:36 +08:00
FIX: Amend broken group automatic member dialog (#31854)
When creating or editing a group, we are meant to show a dialog telling the admin how many members will be automatically added.
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Admin::GroupsController < Admin::StaffController
|
||||
MAX_AUTO_MEMBERSHIP_DOMAINS_LOOKUP = 10
|
||||
|
||||
def create
|
||||
guardian.ensure_can_create_group!
|
||||
|
||||
@ -94,6 +96,15 @@ class Admin::GroupsController < Admin::StaffController
|
||||
domains -= existing_domains
|
||||
end
|
||||
|
||||
if domains.size > MAX_AUTO_MEMBERSHIP_DOMAINS_LOOKUP
|
||||
raise Discourse::InvalidParameters.new(
|
||||
I18n.t(
|
||||
"groups.errors.counting_too_many_email_domains",
|
||||
count: MAX_AUTO_MEMBERSHIP_DOMAINS_LOOKUP,
|
||||
),
|
||||
)
|
||||
end
|
||||
|
||||
user_count = Group.automatic_membership_users(domains.join("|")).count
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user