mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-04 11:10:04 -04:00
check that changes
param is present
This commit is contained in:
parent
50de22801f
commit
98404d19c5
1 changed files with 9 additions and 8 deletions
|
@ -23,15 +23,16 @@ class Admin::GroupsController < Admin::AdminController
|
|||
def update_patch(group)
|
||||
raise Discourse::InvalidAccess.new("automatic groups do not permit membership changes") if group.automatic
|
||||
|
||||
actions = params[:changes]
|
||||
Array(actions[:add]).each do |username|
|
||||
if user = User.find_by_username(username)
|
||||
group.add(user)
|
||||
if actions = params[:changes]
|
||||
Array(actions[:add]).each do |username|
|
||||
if user = User.find_by_username(username)
|
||||
group.add(user)
|
||||
end
|
||||
end
|
||||
end
|
||||
Array(actions[:delete]).each do |username|
|
||||
if user = User.find_by_username(username)
|
||||
group.remove(user)
|
||||
Array(actions[:delete]).each do |username|
|
||||
if user = User.find_by_username(username)
|
||||
group.remove(user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue