Commit 0bd4449d authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch '2556-approvers-don-t-appear-when-mr-is-created-from-a-fork' into 'master'

Resolve "Approvers don't appear when MR is created from a fork"

Closes #2556

See merge request !2035
parents 1f36bca7 aea415f9
......@@ -19,13 +19,13 @@
.col-sm-10
- author = issuable.author || current_user
- skip_users = issuable.all_approvers_including_groups + [author]
= users_select_tag("merge_request[approver_ids]", multiple: true, class: 'input-large', email_user: true, skip_users: skip_users)
= users_select_tag("merge_request[approver_ids]", multiple: true, class: 'input-large', email_user: true, skip_users: skip_users, project: issuable.target_project)
.help-block
This merge request must be approved by these users.
You can override the project settings by setting your own list of approvers.
- skip_groups = issuable.overall_approver_groups.pluck(:group_id)
= groups_select_tag('merge_request[approver_group_ids]', multiple: true, data: { skip_groups: skip_groups, all_available: true }, class: 'input-large')
= groups_select_tag('merge_request[approver_group_ids]', multiple: true, data: { skip_groups: skip_groups, all_available: true, project: issuable.target_project }, class: 'input-large')
.help-block
This merge request must be approved by members of these groups.
You can override the project settings by setting your own list of approvers.
......
---
title: Fix approvers dropdown when creating a merge request from a fork
merge_request:
author:
......@@ -2,15 +2,15 @@ require 'rails_helper'
feature 'Merge request approvals', js: true, feature: true do
let(:user) { create(:user) }
let(:project) { create(:project, approvals_before_merge: 1) }
let(:project) { create(:project, :public, approvals_before_merge: 1) }
context 'when editing an MR with a different author' do
let(:author) { create(:user) }
let(:merge_request) { create(:merge_request, author: author, source_project: project) }
before do
project.team << [user, :developer]
project.team << [author, :developer]
project.add_developer(user)
project.add_developer(author)
login_as(user)
visit edit_namespace_project_merge_request_path(project.namespace, project, merge_request)
......@@ -27,16 +27,20 @@ feature 'Merge request approvals', js: true, feature: true do
end
end
context 'when creating an MR' do
context 'when creating an MR from a fork' do
let(:other_user) { create(:user) }
let(:non_member) { create(:user) }
let(:forked_project) { create(:project, :public, creator: user) }
before do
project.team << [user, :developer]
project.team << [other_user, :developer]
create(:forked_project_link, forked_to_project: forked_project, forked_from_project: project)
forked_project.add_developer(user)
project.add_developer(user)
project.add_developer(other_user)
login_as(user)
visit new_namespace_project_merge_request_path(project.namespace, project, merge_request: { target_branch: 'master', source_branch: 'feature' })
visit new_namespace_project_merge_request_path(forked_project.namespace, forked_project, merge_request: { target_branch: 'master', source_branch: 'feature' })
find('#s2id_merge_request_approver_ids .select2-input').click
end
......@@ -59,8 +63,8 @@ feature 'Merge request approvals', js: true, feature: true do
let(:other_user) { create(:user) }
before do
project.team << [user, :developer]
project.team << [other_user, :developer]
project.add_developer(user)
project.add_developer(other_user)
login_as(user)
end
......@@ -114,7 +118,7 @@ feature 'Merge request approvals', js: true, feature: true do
let(:merge_request) { create(:merge_request, source_project: project) }
before do
project.team << [user, :developer]
project.add_developer(user)
login_as(user)
end
......@@ -199,8 +203,7 @@ feature 'Merge request approvals', js: true, feature: true do
let(:group) { create :group }
before do
project.team << [user, :developer]
project.add_developer(user)
group.add_developer(other_user)
group.add_developer(user)
......@@ -300,7 +303,7 @@ feature 'Merge request approvals', js: true, feature: true do
end
before do
project.team << [user, :developer]
project.add_developer(user)
login_as(user)
visit new_namespace_project_merge_request_path(project.namespace, project, merge_request: { target_branch: 'master', source_branch: 'feature' })
......
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