Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus G Thiel <linus@yesbabyyes.se>2016-10-05 22:58:34 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-24 13:14:00 +0300
commit036fac06d18e82f0d0696bd1b350548bb47125e8 (patch)
tree039a3699aaa03d00f68795586e4fece71bb937fe /app/controllers/groups/group_members_controller.rb
parent9dbd5b3cfad10b214ae5ef27c39246bbb74a5077 (diff)
Gracefully handle adding of no users to projects and groups
- Disable {project, group} members submit button if no users If no users are selected, the submit button should be disabled. - Alert user when no users were added to {project, group}. When no users were selected for adding, an alert message is flashed that no users were added. - Also, this commit adds a feedback when users were actually added to a project, in symmetry with how group members are handled. Closes #22967, #23270.
Diffstat (limited to 'app/controllers/groups/group_members_controller.rb')
-rw-r--r--app/controllers/groups/group_members_controller.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb
index 18cd800c619..3a373e4a946 100644
--- a/app/controllers/groups/group_members_controller.rb
+++ b/app/controllers/groups/group_members_controller.rb
@@ -21,6 +21,10 @@ class Groups::GroupMembersController < Groups::ApplicationController
end
def create
+ if params[:user_ids].empty?
+ return redirect_to group_group_members_path(@group), alert: 'No users specified.'
+ end
+
@group.add_users(
params[:user_ids].split(','),
params[:access_level],