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
1ec4418f
Commit
1ec4418f
authored
Apr 07, 2020
by
Samantha Ming
Committed by
Phil Hughes
Apr 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass approval rules into MR create
- Rules are loaded for the current target branch
parent
921ccfd8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
3 deletions
+62
-3
app/views/shared/issuable/form/_branch_chooser.html.haml
app/views/shared/issuable/form/_branch_chooser.html.haml
+1
-1
ee/app/assets/javascripts/approvals/components/app.vue
ee/app/assets/javascripts/approvals/components/app.vue
+8
-2
ee/app/assets/javascripts/approvals/mount_mr_edit.js
ee/app/assets/javascripts/approvals/mount_mr_edit.js
+5
-0
ee/changelogs/unreleased/199788-fe-target-branch-approval-rule-create-form.yml
...sed/199788-fe-target-branch-approval-rule-create-form.yml
+5
-0
ee/spec/frontend/approvals/components/app_spec.js
ee/spec/frontend/approvals/components/app_spec.js
+43
-0
No files found.
app/views/shared/issuable/form/_branch_chooser.html.haml
View file @
1ec4418f
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
=
_
(
'From <code>%{source_title}</code> into'
).
html_safe
%
{
source_title:
source_title
}
=
_
(
'From <code>%{source_title}</code> into'
).
html_safe
%
{
source_title:
source_title
}
-
if
issuable
.
new_record?
-
if
issuable
.
new_record?
%code
=
target_title
%code
#js-target-branch-title
=
target_title
=
link_to
_
(
'Change branches'
),
mr_change_branches_path
(
issuable
)
=
link_to
_
(
'Change branches'
),
mr_change_branches_path
(
issuable
)
-
elsif
issuable
.
for_fork?
-
elsif
issuable
.
for_fork?
...
...
ee/app/assets/javascripts/approvals/components/app.vue
View file @
1ec4418f
...
@@ -29,9 +29,15 @@ export default {
...
@@ -29,9 +29,15 @@ export default {
removeModalId
()
{
removeModalId
()
{
return
`
${
this
.
settings
.
prefix
}
-approvals-remove-modal`
;
return
`
${
this
.
settings
.
prefix
}
-approvals-remove-modal`
;
},
},
targetBranch
()
{
if
(
this
.
settings
.
prefix
===
'
mr-edit
'
&&
!
this
.
settings
.
mrSettingsPath
)
{
return
this
.
settings
.
mrCreateTargetBranch
;
}
return
null
;
},
},
created
()
{
},
this
.
fetchRules
();
mounted
()
{
return
this
.
fetchRules
(
this
.
targetBranch
);
},
},
methods
:
{
methods
:
{
...
mapActions
([
'
fetchRules
'
]),
...
mapActions
([
'
fetchRules
'
]),
...
...
ee/app/assets/javascripts/approvals/mount_mr_edit.js
View file @
1ec4418f
...
@@ -12,11 +12,16 @@ export default function mountApprovalInput(el) {
...
@@ -12,11 +12,16 @@ export default function mountApprovalInput(el) {
return
null
;
return
null
;
}
}
const
mrCreateTargetBranch
=
el
.
dataset
.
mrSettingsPath
?
null
:
document
.
querySelector
(
'
#js-target-branch-title
'
)?.
textContent
;
const
store
=
createStore
(
mrEditModule
(),
{
const
store
=
createStore
(
mrEditModule
(),
{
...
el
.
dataset
,
...
el
.
dataset
,
prefix
:
'
mr-edit
'
,
prefix
:
'
mr-edit
'
,
canEdit
:
parseBoolean
(
el
.
dataset
.
canEdit
),
canEdit
:
parseBoolean
(
el
.
dataset
.
canEdit
),
allowMultiRule
:
parseBoolean
(
el
.
dataset
.
allowMultiRule
),
allowMultiRule
:
parseBoolean
(
el
.
dataset
.
allowMultiRule
),
mrCreateTargetBranch
,
});
});
return
new
Vue
({
return
new
Vue
({
...
...
ee/changelogs/unreleased/199788-fe-target-branch-approval-rule-create-form.yml
0 → 100644
View file @
1ec4418f
---
title
:
Support inapplicable rules when creating MR
merge_request
:
27971
author
:
type
:
fixed
ee/spec/frontend/approvals/components/app_spec.js
View file @
1ec4418f
...
@@ -47,6 +47,49 @@ describe('EE Approvals App', () => {
...
@@ -47,6 +47,49 @@ describe('EE Approvals App', () => {
jest
.
spyOn
(
store
.
modules
.
createModal
.
actions
,
'
open
'
);
jest
.
spyOn
(
store
.
modules
.
createModal
.
actions
,
'
open
'
);
});
});
describe
(
'
targetBranch
'
,
()
=>
{
const
targetBranchName
=
'
development
'
;
beforeEach
(()
=>
{
store
.
state
.
settings
.
mrCreateTargetBranch
=
targetBranchName
;
});
it
(
'
passes the target branch name in fetchRules for MR create path
'
,
()
=>
{
store
.
state
.
settings
.
prefix
=
'
mr-edit
'
;
store
.
state
.
settings
.
mrSettingsPath
=
null
;
factory
();
expect
(
store
.
modules
.
approvals
.
actions
.
fetchRules
).
toHaveBeenCalledWith
(
expect
.
anything
(),
targetBranchName
,
undefined
,
);
});
it
(
'
does not pass the target branch name in fetchRules for MR edit path
'
,
()
=>
{
store
.
state
.
settings
.
prefix
=
'
mr-edit
'
;
store
.
state
.
settings
.
mrSettingsPath
=
'
some/path
'
;
factory
();
expect
(
store
.
modules
.
approvals
.
actions
.
fetchRules
).
toHaveBeenCalledWith
(
expect
.
anything
(),
null
,
undefined
,
);
});
it
(
'
does not pass the target branch name in fetchRules for project settings path
'
,
()
=>
{
store
.
state
.
settings
.
prefix
=
'
project-settings
'
;
factory
();
expect
(
store
.
modules
.
approvals
.
actions
.
fetchRules
).
toHaveBeenCalledWith
(
expect
.
anything
(),
null
,
undefined
,
);
});
});
describe
(
'
when allow multi rule
'
,
()
=>
{
describe
(
'
when allow multi rule
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
.
state
.
settings
.
allowMultiRule
=
true
;
store
.
state
.
settings
.
allowMultiRule
=
true
;
...
...
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