Commit 42da7cd3 authored by Rubén Dávila's avatar Rubén Dávila

Fix redirect to wrong URL when merging and MR detail URL has an anchor. #4189

parent 25bf3eb8
...@@ -18,7 +18,7 @@ class @MergeRequestWidget ...@@ -18,7 +18,7 @@ class @MergeRequestWidget
if data.state == "merged" if data.state == "merged"
urlSuffix = if deleteSourceBranch then '?delete_source=true' else '' urlSuffix = if deleteSourceBranch then '?delete_source=true' else ''
window.location.href = window.location.href + urlSuffix window.location.href = window.location.pathname + urlSuffix
else if data.merge_error else if data.merge_error
$('.mr-widget-body').html("<h4>" + data.merge_error + "</h4>") $('.mr-widget-body').html("<h4>" + data.merge_error + "</h4>")
else else
......
...@@ -12,6 +12,14 @@ Feature: Project Merge Requests Acceptance ...@@ -12,6 +12,14 @@ Feature: Project Merge Requests Acceptance
Then I should see merge request merged Then I should see merge request merged
And I should not see the Remove Source Branch button And I should not see the Remove Source Branch button
@javascript
Scenario: Accepting the Merge Request when URL has an anchor
Given I am on the Merge Request detail with note anchor page
When I click on "Remove source branch" option
And I click on Accept Merge Request
Then I should see merge request merged
And I should not see the Remove Source Branch button
@javascript @javascript
Scenario: Accepting the Merge Request without removing the source branch Scenario: Accepting the Merge Request without removing the source branch
Given I am on the Merge Request detail page Given I am on the Merge Request detail page
......
...@@ -6,6 +6,10 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps ...@@ -6,6 +6,10 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps
visit merge_request_path(@merge_request) visit merge_request_path(@merge_request)
end end
step 'I am on the Merge Request detail with note anchor page' do
visit merge_request_path(@merge_request, anchor: 'note_123')
end
step 'I click on "Remove source branch" option' do step 'I click on "Remove source branch" option' do
check('Remove source branch') check('Remove source branch')
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment