mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
FIX: display warning only if all users already added to the group (#10500)
If at least one user can be added to the group, proceed with that action
This commit is contained in:

committed by
GitHub

parent
daddad7fd6
commit
7833853cf1
@ -329,12 +329,12 @@ class GroupsController < ApplicationController
|
||||
'usernames or emails must be present'
|
||||
)
|
||||
end
|
||||
|
||||
if (usernames = group.users.where(id: users.map(&:id)).pluck(:username)).present?
|
||||
usernames_already_in_group = group.users.where(id: users.map(&:id)).pluck(:username)
|
||||
if usernames_already_in_group.present? && usernames_already_in_group.length == users.length
|
||||
render_json_error(I18n.t(
|
||||
"groups.errors.member_already_exist",
|
||||
username: usernames.sort.join(", "),
|
||||
count: usernames.size
|
||||
username: usernames_already_in_group.sort.join(", "),
|
||||
count: usernames_already_in_group.size
|
||||
))
|
||||
else
|
||||
uniq_users = users.uniq
|
||||
|
Reference in New Issue
Block a user