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
778da3ce
Commit
778da3ce
authored
Mar 10, 2020
by
Rajendra Kadam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate merge request approval rules in own class files
parent
08ef4da5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
26 deletions
+63
-26
ee/lib/ee/api/entities.rb
ee/lib/ee/api/entities.rb
+0
-26
ee/lib/ee/api/entities/merge_request_approval_rule.rb
ee/lib/ee/api/entities/merge_request_approval_rule.rb
+11
-0
ee/lib/ee/api/entities/merge_request_approval_rule/source_rule.rb
...e/api/entities/merge_request_approval_rule/source_rule.rb
+13
-0
ee/lib/ee/api/entities/merge_request_approval_state.rb
ee/lib/ee/api/entities/merge_request_approval_state.rb
+15
-0
ee/lib/ee/api/entities/merge_request_approval_state_rule.rb
ee/lib/ee/api/entities/merge_request_approval_state_rule.rb
+13
-0
ee/lib/ee/api/entities/project_approval_rule.rb
ee/lib/ee/api/entities/project_approval_rule.rb
+11
-0
No files found.
ee/lib/ee/api/entities.rb
View file @
778da3ce
...
@@ -262,32 +262,6 @@ module EE
...
@@ -262,32 +262,6 @@ module EE
end
end
end
end
class
ProjectApprovalRule
<
ApprovalRule
expose
:protected_branches
,
using:
::
API
::
Entities
::
ProtectedBranch
,
if:
->
(
rule
,
_
)
{
rule
.
project
.
multiple_approval_rules_available?
}
end
class
MergeRequestApprovalRule
<
ApprovalRule
class
SourceRule
<
Grape
::
Entity
expose
:approvals_required
end
expose
:source_rule
,
using:
SourceRule
end
class
MergeRequestApprovalStateRule
<
MergeRequestApprovalRule
expose
:code_owner
expose
:approved_approvers
,
as: :approved_by
,
using:
::
API
::
Entities
::
UserBasic
expose
:approved?
,
as: :approved
end
class
MergeRequestApprovalState
<
Grape
::
Entity
expose
:approval_rules_overwritten
do
|
approval_state
|
approval_state
.
approval_rules_overwritten?
end
expose
:wrapped_approval_rules
,
as: :rules
,
using:
MergeRequestApprovalStateRule
end
# Being used in private project-level approvals API.
# Being used in private project-level approvals API.
# This overrides the `eligible_approvers` to be exposed as `approvers`.
# This overrides the `eligible_approvers` to be exposed as `approvers`.
#
#
...
...
ee/lib/ee/api/entities/merge_request_approval_rule.rb
0 → 100644
View file @
778da3ce
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
MergeRequestApprovalRule
<
ApprovalRule
expose
:source_rule
,
using:
MergeRequestApprovalRule
::
SourceRule
end
end
end
end
ee/lib/ee/api/entities/merge_request_approval_rule/source_rule.rb
0 → 100644
View file @
778da3ce
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
MergeRequestApprovalRule
<
ApprovalRule
class
SourceRule
<
Grape
::
Entity
expose
:approvals_required
end
end
end
end
end
ee/lib/ee/api/entities/merge_request_approval_state.rb
0 → 100644
View file @
778da3ce
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
MergeRequestApprovalState
<
Grape
::
Entity
expose
:approval_rules_overwritten
do
|
approval_state
|
approval_state
.
approval_rules_overwritten?
end
expose
:wrapped_approval_rules
,
as: :rules
,
using:
MergeRequestApprovalStateRule
end
end
end
end
ee/lib/ee/api/entities/merge_request_approval_state_rule.rb
0 → 100644
View file @
778da3ce
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
MergeRequestApprovalStateRule
<
MergeRequestApprovalRule
expose
:code_owner
expose
:approved_approvers
,
as: :approved_by
,
using:
::
API
::
Entities
::
UserBasic
expose
:approved?
,
as: :approved
end
end
end
end
ee/lib/ee/api/entities/project_approval_rule.rb
0 → 100644
View file @
778da3ce
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
ProjectApprovalRule
<
ApprovalRule
expose
:protected_branches
,
using:
::
API
::
Entities
::
ProtectedBranch
,
if:
->
(
rule
,
_
)
{
rule
.
project
.
multiple_approval_rules_available?
}
end
end
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