BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
f674b601
Commit
f674b601
authored
May 18, 2017
by
Rémy Coutable
Committed by
Timothy Andrew
May 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'fix_removing_invited_member' into 'master'
Fix: Deleting an invited member causes 500 error Closes #32504 See merge request !11481
parent
acbc5c20
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
1 deletion
+34
-1
authorized_destroy_service.rb
app/services/members/authorized_destroy_service.rb
+1
-1
group_members.rb
spec/factories/group_members.rb
+6
-0
project_members.rb
spec/factories/project_members.rb
+6
-0
authorized_destroy_service_spec.rb
spec/services/members/authorized_destroy_service_spec.rb
+21
-0
No files found.
app/services/members/authorized_destroy_service.rb
View file @
f674b601
...
...
@@ -10,7 +10,7 @@ module Members
return
false
if
member
.
is_a?
(
GroupMember
)
&&
member
.
source
.
last_owner?
(
member
.
user
)
Member
.
transaction
do
unassign_issues_and_merge_requests
(
member
)
unassign_issues_and_merge_requests
(
member
)
unless
member
.
invite?
member
.
destroy
end
...
...
spec/factories/group_members.rb
View file @
f674b601
...
...
@@ -10,5 +10,11 @@ FactoryGirl.define do
trait
(
:master
)
{
access_level
GroupMember
::
MASTER
}
trait
(
:owner
)
{
access_level
GroupMember
::
OWNER
}
trait
(
:access_request
)
{
requested_at
Time
.
now
}
trait
(
:invited
)
do
user_id
nil
invite_token
'xxx'
invite_email
'email@email.com'
end
end
end
spec/factories/project_members.rb
View file @
f674b601
...
...
@@ -9,5 +9,11 @@ FactoryGirl.define do
trait
(
:developer
)
{
access_level
ProjectMember
::
DEVELOPER
}
trait
(
:master
)
{
access_level
ProjectMember
::
MASTER
}
trait
(
:access_request
)
{
requested_at
Time
.
now
}
trait
(
:invited
)
do
user_id
nil
invite_token
'xxx'
invite_email
'email@email.com'
end
end
end
spec/services/members/authorized_destroy_service_spec.rb
View file @
f674b601
...
...
@@ -10,6 +10,27 @@ describe Members::AuthorizedDestroyService, services: true do
Issue
.
assigned_to
(
user
).
count
+
MergeRequest
.
assigned_to
(
user
).
count
end
context
'Invited users'
do
# Regression spec for issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/32504
it
'destroys invited project member'
do
project
.
team
<<
[
member_user
,
:developer
]
member
=
create
:project_member
,
:invited
,
project:
project
expect
{
described_class
.
new
(
member
,
member_user
).
execute
}
.
to
change
{
Member
.
count
}.
from
(
2
).
to
(
1
)
end
it
'destroys invited group member'
do
group
.
add_developer
(
member_user
)
member
=
create
:group_member
,
:invited
,
group:
group
expect
{
described_class
.
new
(
member
,
member_user
).
execute
}
.
to
change
{
Member
.
count
}.
from
(
2
).
to
(
1
)
end
end
context
'Group member'
do
it
"unassigns issues and merge requests"
do
group
.
add_developer
(
member_user
)
...
...
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