Commit 7181fdd2 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'issue_3072_target_name' into 'master'

Display target branch on MR list when it is different from project's default

Fixes #3072

The screenshot below shows both previous and current UI state:

![branch-mr-both](/uploads/5c1f0519e42bae4655f3eee37edfc356/branch-mr-both.png)

First merge request has default branch as a target, second one has non default branch as target.

See merge request !1741
parents 8972aef5 746e49fe
...@@ -28,6 +28,7 @@ v 8.2.0 (unreleased) ...@@ -28,6 +28,7 @@ v 8.2.0 (unreleased)
- Allow groups to appear in the search results if the group owner allows it - Allow groups to appear in the search results if the group owner allows it
- New design for project graphs page - New design for project graphs page
- Fix incoming email config defaults - Fix incoming email config defaults
- MR target branch is now visible on a list view when it is different from project's default one
v 8.1.4 v 8.1.4
- Fix bug where manually merged branches in a MR would end up with an empty diff (Stan Hu) - Fix bug where manually merged branches in a MR would end up with an empty diff (Stan Hu)
......
...@@ -31,6 +31,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -31,6 +31,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
@merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE) @merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE)
@merge_requests = @merge_requests.preload(:target_project)
respond_to do |format| respond_to do |format|
format.html format.html
......
...@@ -41,6 +41,11 @@ ...@@ -41,6 +41,11 @@
%span %span
%i.fa.fa-clock-o %i.fa.fa-clock-o
= merge_request.milestone.title = merge_request.milestone.title
- if merge_request.target_project.default_branch != merge_request.target_branch
&nbsp;
%span
%i.fa.fa-code-fork
= merge_request.target_branch
- if merge_request.tasks? - if merge_request.tasks?
%span.task-status %span.task-status
= merge_request.task_status = merge_request.task_status
......
...@@ -16,6 +16,15 @@ Feature: Project Merge Requests ...@@ -16,6 +16,15 @@ Feature: Project Merge Requests
When I visit project "Shop" merge requests page When I visit project "Shop" merge requests page
Then I should see merge request "Bug NS-05" with CI status Then I should see merge request "Bug NS-05" with CI status
Scenario: I should not see target branch name when it is project's default branch
Then I should see "Bug NS-04" in merge requests
And I should not see "master" branch
Scenario: I should see target branch when it is different from default
Given project "Shop" have "Bug NS-06" open merge request
When I visit project "Shop" merge requests page
Then I should see "other_branch" branch
Scenario: I should see rejected merge requests Scenario: I should see rejected merge requests
Given I click link "Closed" Given I click link "Closed"
Then I should see "Feature NS-03" in merge requests Then I should see "Feature NS-03" in merge requests
......
...@@ -40,6 +40,14 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -40,6 +40,14 @@ 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 not see "master" branch' do
expect(page).not_to have_content "master"
end
step 'I should see "other_branch" branch' do
expect(page).to have_content "other_branch"
end
step 'I should see "Bug NS-04" in merge requests' do step 'I should see "Bug NS-04" in merge requests' do
expect(page).to have_content "Bug NS-04" expect(page).to have_content "Bug NS-04"
end end
...@@ -93,6 +101,18 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -93,6 +101,18 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
) )
end end
step 'project "Shop" have "Bug NS-06" open merge request' do
create(:merge_request,
title: "Bug NS-06",
source_project: project,
target_project: project,
source_branch: 'fix',
target_branch: 'other_branch',
author: project.users.first,
description: "# Description header"
)
end
step 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do step 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do
create(:merge_request_with_diffs, create(:merge_request_with_diffs,
title: "Bug NS-05", title: "Bug NS-05",
......
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