Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
c75687b5
Commit
c75687b5
authored
Jan 31, 2019
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update members service to cope with errors
parent
b49563c3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
app/services/members/create_service.rb
app/services/members/create_service.rb
+12
-2
changelogs/unreleased/55098-ui-bug-adding-group-members-with-lower-permissions.yml
...98-ui-bug-adding-group-members-with-lower-permissions.yml
+5
-0
spec/services/members/create_service_spec.rb
spec/services/members/create_service_spec.rb
+9
-0
No files found.
app/services/members/create_service.rb
View file @
c75687b5
...
...
@@ -19,9 +19,19 @@ module Members
current_user:
current_user
)
members
.
each
{
|
member
|
after_execute
(
member:
member
)
}
errors
=
[]
success
members
.
each
do
|
member
|
if
member
.
errors
.
any?
errors
<<
"
#{
member
.
user
.
username
}
:
#{
member
.
errors
.
full_messages
.
to_sentence
}
"
else
after_execute
(
member:
member
)
end
end
return
success
unless
errors
.
any?
error
(
errors
.
to_sentence
)
end
private
...
...
changelogs/unreleased/55098-ui-bug-adding-group-members-with-lower-permissions.yml
0 → 100644
View file @
c75687b5
---
title
:
Resolve UI bug adding group members with lower permissions
merge_request
:
24820
author
:
type
:
fixed
spec/services/members/create_service_spec.rb
View file @
c75687b5
...
...
@@ -36,4 +36,13 @@ describe Members::CreateService do
expect
(
result
[
:message
]).
to
be_present
expect
(
project
.
users
).
not_to
include
project_user
end
it
'does not add an invalid member'
do
params
=
{
user_ids:
project_user
.
id
.
to_s
,
access_level:
-
1
}
result
=
described_class
.
new
(
user
,
params
).
execute
(
project
)
expect
(
result
[
:status
]).
to
eq
(
:error
)
expect
(
result
[
:message
]).
to
include
(
project_user
.
username
)
expect
(
project
.
users
).
not_to
include
project_user
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment