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
3b9d4255
Commit
3b9d4255
authored
Jan 28, 2019
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dry feature check into a method
parent
34c5a8db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
ee/app/models/concerns/approvable_for_rule.rb
ee/app/models/concerns/approvable_for_rule.rb
+1
-1
ee/app/models/concerns/visible_approvable_for_rule.rb
ee/app/models/concerns/visible_approvable_for_rule.rb
+8
-4
No files found.
ee/app/models/concerns/approvable_for_rule.rb
View file @
3b9d4255
...
...
@@ -16,7 +16,7 @@ module ApprovableForRule
FORWARDABLE_METHODS
.
each
do
|
method
|
define_method
(
method
)
do
|*
args
|
return
super
(
*
args
)
if
::
Feature
.
disabled?
(
:approval_rules
,
project
)
return
super
(
*
args
)
if
approval_rules_disabled?
approval_state
.
public_send
(
method
,
*
args
)
# rubocop:disable GitlabSecurity/PublicSend
end
...
...
ee/app/models/concerns/visible_approvable_for_rule.rb
View file @
3b9d4255
...
...
@@ -4,13 +4,13 @@
# that include the Approvable concern
module
VisibleApprovableForRule
def
approvers_left
return
super
if
::
Feature
.
disabled?
(
:approval_rules
,
project
)
return
super
if
approval_rules_disabled?
approval_state
.
unactioned_approvers
end
def
overall_approvers
(
exclude_code_owners:
false
)
return
super
if
::
Feature
.
disabled?
(
:approval_rules
,
project
)
return
super
if
approval_rules_disabled?
options
=
{
target: :users
}
options
[
:code_owner
]
=
false
if
exclude_code_owners
...
...
@@ -21,15 +21,19 @@ module VisibleApprovableForRule
end
def
all_approvers_including_groups
return
super
if
::
Feature
.
disabled?
(
:approval_rules
,
project
)
return
super
if
approval_rules_disabled?
approval_state
.
approvers
end
def
approvers_from_groups
return
super
if
::
Feature
.
disabled?
(
:approval_rules
,
project
)
return
super
if
approval_rules_disabled?
groups
=
approval_state
.
wrapped_approval_rules
.
flat_map
(
&
:groups
)
User
.
joins
(
:group_members
).
where
(
members:
{
source_id:
groups
})
end
def
approval_rules_disabled?
::
Feature
.
disabled?
(
:approval_rules
,
project
)
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