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
4baf46d7
Commit
4baf46d7
authored
Aug 13, 2020
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disallow editing target branch after merge request is merged
Closes
https://gitlab.com/gitlab-org/gitlab/-/issues/223235
parent
ac10aa1a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
app/views/shared/issuable/form/_branch_chooser.html.haml
app/views/shared/issuable/form/_branch_chooser.html.haml
+3
-1
spec/features/merge_request/user_edits_merge_request_spec.rb
spec/features/merge_request/user_edits_merge_request_spec.rb
+17
-6
No files found.
app/views/shared/issuable/form/_branch_chooser.html.haml
View file @
4baf46d7
...
...
@@ -17,7 +17,9 @@
=
link_to
_
(
'Change branches'
),
mr_change_branches_path
(
issuable
)
-
elsif
issuable
.
for_fork?
%code
=
issuable
.
target_project_path
+
":"
-
unless
issuable
.
new_record?
-
if
issuable
.
merged?
%code
=
target_title
-
unless
issuable
.
new_record?
||
issuable
.
merged?
%span
.dropdown.gl-ml-2.d-inline-block
=
form
.
hidden_field
(
:target_branch
,
{
class:
'target_branch js-target-branch-select ref-name mw-xl'
,
...
...
spec/features/merge_request/user_edits_merge_request_spec.rb
View file @
4baf46d7
...
...
@@ -85,13 +85,24 @@ RSpec.describe 'User edits a merge request', :js do
end
end
it
'changes the target branch'
do
expect
(
page
).
to
have_content
(
'From master into feature'
)
describe
'changing target branch'
do
it
'allows user to change target branch'
do
expect
(
page
).
to
have_content
(
'From master into feature'
)
select2
(
'merge-test'
,
from:
'#merge_request_target_branch'
)
click_button
(
'Save changes'
)
select2
(
'merge-test'
,
from:
'#merge_request_target_branch'
)
click_button
(
'Save changes'
)
expect
(
page
).
to
have_content
(
"Request to merge
#{
merge_request
.
source_branch
}
into merge-test"
)
expect
(
page
).
to
have_content
(
"changed target branch from
#{
merge_request
.
target_branch
}
to merge-test"
)
end
expect
(
page
).
to
have_content
(
"Request to merge
#{
merge_request
.
source_branch
}
into merge-test"
)
expect
(
page
).
to
have_content
(
"changed target branch from
#{
merge_request
.
target_branch
}
to merge-test"
)
describe
'merged merge request'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
state: :merged
)
}
it
'does not allow user to change target branch'
do
expect
(
page
).
to
have_content
(
'From master into feature'
)
expect
(
page
).
not_to
have_selector
(
'.select2-container'
)
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