Merge branch 'fix-merge-request-assignee-list' into 'master'
Use the user list from the target project in a merge request
### What does this MR do?
This MR derives the assignable users from the target project.
### Why was this MR needed?
In a merge request, the assignable users uses the list from the forked project, not the target project where the merge request will be going. For example, if I fork a project from the gitlab-org namespace into my personal namespace, make some changes, and then create a merge request, the only users I see are me. I think it makes more sense to show all the users in gitlab-org. This is a regression caused by 1c2711f
.
### What are the relevant issue numbers?
Closes #1535
See merge request !682
This commit is contained in:
commit
c4e48d27a7
|
@ -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.1
|
v 7.11.1
|
||||||
- no changes
|
- no changes
|
||||||
|
@ -1440,4 +1441,4 @@ v 0.8.0
|
||||||
- stability
|
- stability
|
||||||
- security fixes
|
- security fixes
|
||||||
- increased test coverage
|
- increased test coverage
|
||||||
- email notification
|
- email notification
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
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 @@
|
||||||
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 @@
|
||||||
.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)
|
||||||
|
|
||||||
= 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 @@
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue