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
eea92c4e
Commit
eea92c4e
authored
May 26, 2020
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add section to name uniqueness validation
parent
bedde99a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
ee/app/models/approval_merge_request_rule.rb
ee/app/models/approval_merge_request_rule.rb
+1
-1
ee/spec/models/approval_merge_request_rule_spec.rb
ee/spec/models/approval_merge_request_rule_spec.rb
+1
-1
No files found.
ee/app/models/approval_merge_request_rule.rb
View file @
eea92c4e
...
...
@@ -26,7 +26,7 @@ class ApprovalMergeRequestRule < ApplicationRecord
scope
:code_owner_approval_optional
,
->
{
code_owner
.
where
(
approvals_required:
0
)
}
scope
:code_owner_approval_required
,
->
{
code_owner
.
where
(
'approvals_required > 0'
)
}
validates
:name
,
uniqueness:
{
scope:
[
:merge_request_id
,
:rule_type
]
}
validates
:name
,
uniqueness:
{
scope:
[
:merge_request_id
,
:rule_type
,
:section
]
}
validates
:rule_type
,
uniqueness:
{
scope: :merge_request_id
,
message:
proc
{
_
(
'any-approver for the merge request already exists'
)
}
},
if: :any_approver?
validates
:report_type
,
presence:
true
,
if: :report_approver?
# Temporary validations until `code_owner` can be dropped in favor of `rule_type`
...
...
ee/spec/models/approval_merge_request_rule_spec.rb
View file @
eea92c4e
...
...
@@ -17,7 +17,7 @@ describe ApprovalMergeRequestRule do
end
it
'is invalid when name not unique within rule type and merge request'
do
is_expected
.
to
validate_uniqueness_of
(
:name
).
scoped_to
([
:merge_request_id
,
:rule_type
])
is_expected
.
to
validate_uniqueness_of
(
:name
).
scoped_to
([
:merge_request_id
,
:rule_type
,
:section
])
end
context
'approval_project_rule is set'
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