Commit 7a7ce701 authored by Stan Hu's avatar Stan Hu

Use the user list from the target project in a merge request

Closes #1535
parent 2b1b026a
...@@ -5,6 +5,7 @@ v 7.12.0 (unreleased) ...@@ -5,6 +5,7 @@ v 7.12.0 (unreleased)
- Disabled expansion of top/bottom blobs for new file diffs - Disabled expansion of top/bottom blobs for new file diffs
- Update Asciidoctor gem to version 1.5.2. (Jakub Jirutka) - Update Asciidoctor gem to version 1.5.2. (Jakub Jirutka)
- Fix resolving of relative links to repository files in AsciiDoc documents. (Jakub Jirutka) - Fix resolving of relative links to repository files in AsciiDoc documents. (Jakub Jirutka)
- Use the user list from the target project in a merge request (Stan Hu)
v 7.11.0 (unreleased) v 7.11.0 (unreleased)
- Fall back to Plaintext when Syntaxhighlighting doesn't work. Fixes some buggy lexers (Hannes Rosenögger) - Fall back to Plaintext when Syntaxhighlighting doesn't work. Fixes some buggy lexers (Hannes Rosenögger)
......
...@@ -10,6 +10,7 @@ module SelectsHelper ...@@ -10,6 +10,7 @@ module SelectsHelper
any_user = opts[:any_user] || false any_user = opts[:any_user] || false
email_user = opts[:email_user] || false email_user = opts[:email_user] || false
first_user = opts[:first_user] && current_user ? current_user.username : false first_user = opts[:first_user] && current_user ? current_user.username : false
project = opts[:project] || @project
html = { html = {
class: css_class, class: css_class,
...@@ -21,8 +22,8 @@ module SelectsHelper ...@@ -21,8 +22,8 @@ module SelectsHelper
} }
unless opts[:scope] == :all unless opts[:scope] == :all
if @project if project
html['data-project-id'] = @project.id html['data-project-id'] = project.id
elsif @group elsif @group
html['data-group-id'] = @group.id html['data-group-id'] = @group.id
end end
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
This merge request is marked a <strong>Work In Progress</strong>. This merge request is marked a <strong>Work In Progress</strong>.
When it's ready, remove the <code>WIP</code> prefix from the title to allow it to be accepted. When it's ready, remove the <code>WIP</code> prefix from the title to allow it to be accepted.
- else - else
To prevent this merge request from being accepted before it's ready, To prevent this merge request from being accepted before it's ready,
mark it a <strong>Work In Progress</strong> by starting the title with <code>[WIP]</code> or <code>WIP:</code>. mark it a <strong>Work In Progress</strong> by starting the title with <code>[WIP]</code> or <code>WIP:</code>.
.form-group.issuable-description .form-group.issuable-description
= f.label :description, 'Description', class: 'control-label' = f.label :description, 'Description', class: 'control-label'
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
.col-sm-10 .col-sm-10
= users_select_tag("#{issuable.class.model_name.param_key}[assignee_id]", = users_select_tag("#{issuable.class.model_name.param_key}[assignee_id]",
placeholder: 'Select a user', class: 'custom-form-control', null_user: true, placeholder: 'Select a user', class: 'custom-form-control', null_user: true,
selected: issuable.assignee_id) selected: issuable.assignee_id, project: @target_project || @project)
&nbsp; &nbsp;
= link_to 'Assign to me', '#', class: 'btn assign-to-me-link' = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
.form-group .form-group
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
none none
.issuable-context-selectbox .issuable-context-selectbox
- if can?(current_user, :modify_merge_request, @merge_request) - if can?(current_user, :modify_merge_request, @merge_request)
= users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @merge_request.assignee_id, null_user: true) = users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @merge_request.assignee_id, project: @target_project, null_user: true)
%div.prepend-top-20.clearfix %div.prepend-top-20.clearfix
.issuable-context-title .issuable-context-title
......
...@@ -38,3 +38,15 @@ Feature: Project Forked Merge Requests ...@@ -38,3 +38,15 @@ Feature: Project Forked Merge Requests
Given I visit project "Forked Shop" merge requests page Given I visit project "Forked Shop" merge requests page
And I click link "New Merge Request" And I click link "New Merge Request"
Then the target repository should be the original repository Then the target repository should be the original repository
@javascript
Scenario: I see the users in the target project for a new merge request
Given I logout
And I sign in as an admin
And I have a project forked off of "Shop" called "Forked Shop"
Then I visit project "Forked Shop" merge requests page
And I click link "New Merge Request"
And I fill out a "Merge Request On Forked Project" merge request
When I click "Assign to" dropdown"
Then I should see the target project ID in the input selector
And I should see the users from the target project ID
...@@ -128,6 +128,21 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -128,6 +128,21 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
page.should have_select("merge_request_target_project_id", selected: @project.path_with_namespace) page.should have_select("merge_request_target_project_id", selected: @project.path_with_namespace)
end end
step 'I click "Assign to" dropdown"' do
first('.ajax-users-select').click
end
step 'I should see the target project ID in the input selector' do
expect(page).to have_selector("input[data-project-id=\"#{@project.id}\"]")
end
step 'I should see the users from the target project ID' do
expect(page).to have_selector('.user-result', visible: true, count: 2)
users = page.all('.user-name')
users[0].text.should == 'Unassigned'
users[1].text.should == @project.users.first.name
end
# Verify a link is generated against the correct project # Verify a link is generated against the correct project
def verify_commit_link(container_div, container_project) def verify_commit_link(container_div, container_project)
# This should force a wait for the javascript to execute # This should force a wait for the javascript to execute
......
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