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
a65e4549
Commit
a65e4549
authored
Jul 29, 2021
by
Jackie Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix empty recursive query for base_and_ancestors
Changelog: fixed
parent
3399b4c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
app/models/user.rb
app/models/user.rb
+2
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+16
-0
No files found.
app/models/user.rb
View file @
a65e4549
...
...
@@ -1005,6 +1005,8 @@ class User < ApplicationRecord
# Returns a relation of groups the user has access to, including their parent
# and child groups (recursively).
def
all_expanded_groups
return
groups
if
groups
.
empty?
Gitlab
::
ObjectHierarchy
.
new
(
groups
).
all_objects
end
...
...
spec/models/user_spec.rb
View file @
a65e4549
...
...
@@ -4002,6 +4002,14 @@ RSpec.describe User do
]
end
end
context
'when the user is not saved'
do
let
(
:user
)
{
build
(
:user
)
}
it
'returns empty when there are no groups or ancestor groups for the user'
do
is_expected
.
to
eq
([])
end
end
end
describe
'#refresh_authorized_projects'
,
:clean_gitlab_redis_shared_state
do
...
...
@@ -4263,6 +4271,14 @@ RSpec.describe User do
expect
(
user
.
two_factor_grace_period
).
to
be
48
end
end
context
'when the user is not saved'
do
let
(
:user
)
{
build
(
:user
)
}
it
'does not raise an ActiveRecord::StatementInvalid statement exception'
do
expect
{
user
.
update_two_factor_requirement
}.
not_to
raise_error
end
end
end
describe
'#source_groups_of_two_factor_authentication_requirement'
do
...
...
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