check that `changes` param is present

This commit is contained in:
Jason W. May 2014-11-21 10:03:29 -08:00
parent 50de22801f
commit 98404d19c5
1 changed files with 9 additions and 8 deletions

View File

@ -23,7 +23,7 @@ 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]
if actions = params[:changes]
Array(actions[:add]).each do |username|
if user = User.find_by_username(username)
group.add(user)
@ -34,6 +34,7 @@ class Admin::GroupsController < Admin::AdminController
group.remove(user)
end
end
end
render json: success_json
end