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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e46a1af1
Commit
e46a1af1
authored
Jan 24, 2022
by
Vijay Hawoldar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve active member test and query
parent
d74a9d99
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
ee/app/models/ee/member.rb
ee/app/models/ee/member.rb
+1
-1
ee/spec/models/member_spec.rb
ee/spec/models/member_spec.rb
+1
-1
No files found.
ee/app/models/ee/member.rb
View file @
e46a1af1
...
...
@@ -148,7 +148,7 @@ module EE
def
set_membership_activation
return
unless
group
return
if
user
&&
::
Member
.
in_hierarchy
(
group
.
root_ancestor
).
with_user
(
user
).
with_state
(
:active
).
limit
(
1
).
any?
return
if
user
&&
::
Member
.
in_hierarchy
(
group
).
with_user
(
user
).
with_state
(
:active
).
any?
self
.
state
=
::
Member
::
STATE_AWAITING
if
group
.
user_cap_reached?
end
...
...
ee/spec/models/member_spec.rb
View file @
e46a1af1
...
...
@@ -244,8 +244,8 @@ RSpec.describe Member, type: :model do
context
'when the user is already an active project member'
do
it
'sets the group member to active'
do
create
(
:project_member
,
:active
,
project:
project
,
user:
user
)
subgroup
.
add_owner
(
user
)
expect
{
subgroup
.
add_owner
(
user
)
}.
to
change
{
::
Member
.
with_state
(
:active
).
count
}.
by
(
1
)
expect
(
user
.
group_members
.
last
).
to
be_active
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