summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRubén Dávila <Ruben@GitLab.com>2015-12-21 22:59:15 -0500
committerRubén Dávila <Ruben@GitLab.com>2015-12-21 22:59:15 -0500
commit42da7cd375a615d0ba092495981682bafdb99b47 (patch)
treee1a50b71140969c7aa01d2c217a4eca854d8c566
parent25bf3eb8041be93d9003d2cac1323f4d18d317ec (diff)
downloadgitlab-ce-42da7cd375a615d0ba092495981682bafdb99b47.tar.gz
Fix redirect to wrong URL when merging and MR detail URL has an anchor. #4189issue_4189
-rw-r--r--app/assets/javascripts/merge_request_widget.js.coffee2
-rw-r--r--features/project/merge_requests/accept.feature8
-rw-r--r--features/steps/project/merge_requests/acceptance.rb4
3 files changed, 13 insertions, 1 deletions
diff --git a/app/assets/javascripts/merge_request_widget.js.coffee b/app/assets/javascripts/merge_request_widget.js.coffee
index c4b63966fe7..738ffc8343b 100644
--- a/app/assets/javascripts/merge_request_widget.js.coffee
+++ b/app/assets/javascripts/merge_request_widget.js.coffee
@@ -18,7 +18,7 @@ class @MergeRequestWidget
if data.state == "merged"
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
$('.mr-widget-body').html("<h4>" + data.merge_error + "</h4>")
else
diff --git a/features/project/merge_requests/accept.feature b/features/project/merge_requests/accept.feature
index d5e4f2b0bd8..330ec8ae0fe 100644
--- a/features/project/merge_requests/accept.feature
+++ b/features/project/merge_requests/accept.feature
@@ -13,6 +13,14 @@ Feature: Project Merge Requests Acceptance
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
Scenario: Accepting the Merge Request without removing the source branch
Given I am on the Merge Request detail page
When I click on Accept Merge Request
diff --git a/features/steps/project/merge_requests/acceptance.rb b/features/steps/project/merge_requests/acceptance.rb
index 383c055c4ef..2685f5fd6b4 100644
--- a/features/steps/project/merge_requests/acceptance.rb
+++ b/features/steps/project/merge_requests/acceptance.rb
@@ -6,6 +6,10 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps
visit merge_request_path(@merge_request)
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
check('Remove source branch')
end