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
e741068b
Commit
e741068b
authored
Oct 03, 2019
by
Brett Walker
Committed by
Douglas Barbosa Alexandre
Oct 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the feature flag :emails_disabled
as it's no longer needed
parent
437a626b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
4 additions
and
54 deletions
+4
-54
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+1
-2
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+1
-1
app/models/namespace.rb
app/models/namespace.rb
+1
-1
app/models/project.rb
app/models/project.rb
+1
-1
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+0
-26
spec/models/project_spec.rb
spec/models/project_spec.rb
+0
-23
No files found.
app/helpers/groups_helper.rb
View file @
e741068b
...
@@ -32,7 +32,6 @@ module GroupsHelper
...
@@ -32,7 +32,6 @@ module GroupsHelper
end
end
def
can_disable_group_emails?
(
group
)
def
can_disable_group_emails?
(
group
)
Feature
.
enabled?
(
:emails_disabled
,
group
,
default_enabled:
true
)
&&
can?
(
current_user
,
:set_emails_disabled
,
group
)
&&
!
group
.
parent
&
.
emails_disabled?
can?
(
current_user
,
:set_emails_disabled
,
group
)
&&
!
group
.
parent
&
.
emails_disabled?
end
end
...
...
app/helpers/projects_helper.rb
View file @
e741068b
...
@@ -160,7 +160,7 @@ module ProjectsHelper
...
@@ -160,7 +160,7 @@ module ProjectsHelper
def
can_disable_emails?
(
project
,
current_user
)
def
can_disable_emails?
(
project
,
current_user
)
return
false
if
project
.
group
&
.
emails_disabled?
return
false
if
project
.
group
&
.
emails_disabled?
can?
(
current_user
,
:set_emails_disabled
,
project
)
&&
Feature
.
enabled?
(
:emails_disabled
,
project
,
default_enabled:
true
)
can?
(
current_user
,
:set_emails_disabled
,
project
)
end
end
def
last_push_event
def
last_push_event
...
...
app/models/namespace.rb
View file @
e741068b
...
@@ -182,7 +182,7 @@ class Namespace < ApplicationRecord
...
@@ -182,7 +182,7 @@ class Namespace < ApplicationRecord
# any ancestor can disable emails for all descendants
# any ancestor can disable emails for all descendants
def
emails_disabled?
def
emails_disabled?
strong_memoize
(
:emails_disabled
)
do
strong_memoize
(
:emails_disabled
)
do
Feature
.
enabled?
(
:emails_disabled
,
self
,
default_enabled:
true
)
&&
self_and_ancestors
.
where
(
emails_disabled:
true
).
exists?
self_and_ancestors
.
where
(
emails_disabled:
true
).
exists?
end
end
end
end
...
...
app/models/project.rb
View file @
e741068b
...
@@ -664,7 +664,7 @@ class Project < ApplicationRecord
...
@@ -664,7 +664,7 @@ class Project < ApplicationRecord
def
emails_disabled?
def
emails_disabled?
strong_memoize
(
:emails_disabled
)
do
strong_memoize
(
:emails_disabled
)
do
# disabling in the namespace overrides the project setting
# disabling in the namespace overrides the project setting
Feature
.
enabled?
(
:emails_disabled
,
self
,
default_enabled:
true
)
&&
(
super
||
namespace
.
emails_disabled?
)
super
||
namespace
.
emails_disabled?
end
end
end
end
...
...
spec/models/namespace_spec.rb
View file @
e741068b
...
@@ -896,32 +896,6 @@ describe Namespace do
...
@@ -896,32 +896,6 @@ describe Namespace do
end
end
end
end
end
end
context
'when :emails_disabled feature flag is off'
do
before
do
stub_feature_flags
(
emails_disabled:
false
)
end
context
'when not a subgroup'
do
it
'returns false'
do
group
=
create
(
:group
,
emails_disabled:
true
)
expect
(
group
.
emails_disabled?
).
to
be_falsey
end
end
context
'when a subgroup and ancestor emails are disabled'
do
let
(
:grandparent
)
{
create
(
:group
)
}
let
(
:parent
)
{
create
(
:group
,
parent:
grandparent
)
}
let
(
:group
)
{
create
(
:group
,
parent:
parent
)
}
it
'returns false'
do
grandparent
.
update_attribute
(
:emails_disabled
,
true
)
expect
(
group
.
emails_disabled?
).
to
be_falsey
end
end
end
end
end
describe
'#pages_virtual_domain'
do
describe
'#pages_virtual_domain'
do
...
...
spec/models/project_spec.rb
View file @
e741068b
...
@@ -2387,29 +2387,6 @@ describe Project do
...
@@ -2387,29 +2387,6 @@ describe Project do
expect
(
project
.
emails_disabled?
).
to
be_truthy
expect
(
project
.
emails_disabled?
).
to
be_truthy
end
end
end
end
context
'when :emails_disabled feature flag is off'
do
before
do
stub_feature_flags
(
emails_disabled:
false
)
end
context
'emails disabled in group'
do
it
'returns false'
do
allow
(
project
.
namespace
).
to
receive
(
:emails_disabled?
)
{
true
}
expect
(
project
.
emails_disabled?
).
to
be_falsey
end
end
context
'emails enabled in group'
do
it
'returns false'
do
allow
(
project
.
namespace
).
to
receive
(
:emails_disabled?
)
{
false
}
project
.
update_attribute
(
:emails_disabled
,
true
)
expect
(
project
.
emails_disabled?
).
to
be_falsey
end
end
end
end
end
describe
'#lfs_enabled?'
do
describe
'#lfs_enabled?'
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