Commit 6f50cef8 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'fix/13928-wrong-iid-of-max-iid' into 'master'

Fixes "iid of max iid" in Issuable sidebar for merged MR


Fixes #13928.

See merge request !3046
parents a628db7b e632bd26
...@@ -31,6 +31,7 @@ v 8.6.0 (unreleased) ...@@ -31,6 +31,7 @@ v 8.6.0 (unreleased)
- Allow to define on which builds the current one depends on - Allow to define on which builds the current one depends on
- Fix bug where Bitbucket `closed` issues were imported as `opened` (Iuri de Silvio) - Fix bug where Bitbucket `closed` issues were imported as `opened` (Iuri de Silvio)
- Don't show Issues/MRs from archived projects in Groups view - Don't show Issues/MRs from archived projects in Groups view
- Fix wrong "iid of max iid" in Issuable sidebar for some merged MRs
- Increase the notes polling timeout over time (Roberto Dip) - Increase the notes polling timeout over time (Roberto Dip)
- Add shortcut to toggle markdown preview (Florent Baldino) - Add shortcut to toggle markdown preview (Florent Baldino)
- Show labels in dashboard and group milestone views - Show labels in dashboard and group milestone views
......
...@@ -31,7 +31,11 @@ module IssuablesHelper ...@@ -31,7 +31,11 @@ module IssuablesHelper
end end
def issuable_state_scope(issuable) def issuable_state_scope(issuable)
if issuable.respond_to?(:merged?) && issuable.merged?
:merged
else
issuable.open? ? :opened : :closed issuable.open? ? :opened : :closed
end end
end
end end
...@@ -46,11 +46,18 @@ Feature: Project Merge Requests ...@@ -46,11 +46,18 @@ Feature: Project Merge Requests
Then I should see "Feature NS-03" in merge requests Then I should see "Feature NS-03" in merge requests
And I should see "Bug NS-04" in merge requests And I should see "Bug NS-04" in merge requests
Scenario: I visit merge request page Scenario: I visit an open merge request page
Given I click link "Bug NS-04" Given I click link "Bug NS-04"
Then I should see merge request "Bug NS-04" Then I should see merge request "Bug NS-04"
And I should see "1 of 1" in the sidebar And I should see "1 of 1" in the sidebar
Scenario: I visit a merged merge request page
Given project "Shop" have "Feature NS-05" merged merge request
And I click link "Merged"
And I click link "Feature NS-05"
Then I should see merge request "Feature NS-05"
And I should see "3 of 3" in the sidebar
Scenario: I close merge request page Scenario: I close merge request page
Given I click link "Bug NS-04" Given I click link "Bug NS-04"
And I click link "Close" And I click link "Close"
......
...@@ -16,10 +16,18 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -16,10 +16,18 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
click_link "Bug NS-04" click_link "Bug NS-04"
end end
step 'I click link "Feature NS-05"' do
click_link "Feature NS-05"
end
step 'I click link "All"' do step 'I click link "All"' do
click_link "All" click_link "All"
end end
step 'I click link "Merged"' do
click_link "Merged"
end
step 'I click link "Closed"' do step 'I click link "Closed"' do
click_link "Closed" click_link "Closed"
end end
...@@ -40,6 +48,10 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -40,6 +48,10 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
expect(page).to have_content "Bug NS-04" expect(page).to have_content "Bug NS-04"
end end
step 'I should see merge request "Feature NS-05"' do
expect(page).to have_content "Feature NS-05"
end
step 'I should not see "master" branch' do step 'I should not see "master" branch' do
expect(find('.merge-request-info')).not_to have_content "master" expect(find('.merge-request-info')).not_to have_content "master"
end end
...@@ -120,6 +132,14 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -120,6 +132,14 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
author: project.users.first) author: project.users.first)
end end
step 'project "Shop" have "Feature NS-05" merged merge request' do
create(:merged_merge_request,
title: "Feature NS-05",
source_project: project,
target_project: project,
author: project.users.first)
end
step 'project "Shop" have "Bug NS-07" open merge request with rebased branch' do step 'project "Shop" have "Bug NS-07" open merge request with rebased branch' do
create(:merge_request, :rebased, create(:merge_request, :rebased,
title: "Bug NS-07", title: "Bug NS-07",
......
...@@ -147,6 +147,10 @@ module SharedIssuable ...@@ -147,6 +147,10 @@ module SharedIssuable
expect_sidebar_content('2 of 2') expect_sidebar_content('2 of 2')
end end
step 'I should see "3 of 3" in the sidebar' do
expect_sidebar_content('3 of 3')
end
step 'I click link "Next" in the sidebar' do step 'I click link "Next" in the sidebar' do
page.within '.issuable-sidebar' do page.within '.issuable-sidebar' do
click_link 'Next' click_link 'Next'
......
...@@ -56,6 +56,10 @@ FactoryGirl.define do ...@@ -56,6 +56,10 @@ FactoryGirl.define do
target_branch "feature" target_branch "feature"
end end
trait :merged do
state :merged
end
trait :closed do trait :closed do
state :closed state :closed
end end
...@@ -84,6 +88,7 @@ FactoryGirl.define do ...@@ -84,6 +88,7 @@ FactoryGirl.define do
merge_user author merge_user author
end end
factory :merged_merge_request, traits: [:merged]
factory :closed_merge_request, traits: [:closed] factory :closed_merge_request, traits: [:closed]
factory :reopened_merge_request, traits: [:reopened] factory :reopened_merge_request, traits: [:reopened]
factory :merge_request_with_diffs, traits: [:with_diffs] factory :merge_request_with_diffs, traits: [:with_diffs]
......
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