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
f38c7780
Commit
f38c7780
authored
Jan 16, 2020
by
Ohad Dahan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '196371' of gitlab.com:ohaddahan/gitlab into 196371
parents
71714a0f
8f7c5746
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
app/models/namespace.rb
app/models/namespace.rb
+5
-1
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+6
-0
No files found.
app/models/namespace.rb
View file @
f38c7780
...
...
@@ -186,7 +186,11 @@ class Namespace < ApplicationRecord
# any ancestor can disable emails for all descendants
def
emails_disabled?
strong_memoize
(
:emails_disabled
)
do
if
parent_id
self_and_ancestors
.
where
(
emails_disabled:
true
).
exists?
else
!!
emails_disabled
end
end
end
...
...
spec/models/namespace_spec.rb
View file @
f38c7780
...
...
@@ -923,6 +923,12 @@ describe Namespace do
expect
(
group
.
emails_disabled?
).
to
be_truthy
end
it
'not query the db when there is no parent group'
do
group
=
create
(
:group
,
emails_disabled:
true
)
expect
{
group
.
emails_disabled?
}.
not_to
exceed_query_limit
(
0
)
end
end
context
'when a subgroup'
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