summaryrefslogtreecommitdiff
path: root/app/controllers/admin
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-04-20 18:20:30 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-04-20 19:25:02 +0300
commitbae1644015592c3e432832ec6a0ac07770d46685 (patch)
tree0cb0ffc7aab45c0310e76640d86286d5e4d365ba /app/controllers/admin
parent9e4908afa6597bf598c24fa54ce13d6efb57cf38 (diff)
downloadgitlab-ce-bae1644015592c3e432832ec6a0ac07770d46685.tar.gz
Refactor Admin::GroupsController#members_update method and add some specsdz-refactor-admin-group-members
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/admin')
-rw-r--r--app/controllers/admin/groups_controller.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb
index f28bbdeff5a..fc8d4d02ddf 100644
--- a/app/controllers/admin/groups_controller.rb
+++ b/app/controllers/admin/groups_controller.rb
@@ -43,9 +43,13 @@ class Admin::GroupsController < Admin::ApplicationController
end
def members_update
- @group.add_users(params[:user_ids].split(','), params[:access_level], current_user: current_user)
+ status = Members::CreateService.new(@group, current_user, params).execute
- redirect_to [:admin, @group], notice: 'Users were successfully added.'
+ if status
+ redirect_to [:admin, @group], notice: 'Users were successfully added.'
+ else
+ redirect_to [:admin, @group], alert: 'No users specified.'
+ end
end
def destroy