Commit be543c37 authored by jplang's avatar jplang

Support issue[assigned_to_id]=me when prefilling issues (#28502).

Patch by Mizuki ISHIKAWA.

git-svn-id: https://svn.redmine.org/redmine/trunk@17964 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 30f6b87a
......@@ -466,6 +466,7 @@ class IssuesController < ApplicationController
@issue.init_journal(User.current)
issue_attributes = params[:issue]
issue_attributes[:assigned_to_id] = User.current.id if issue_attributes && issue_attributes[:assigned_to_id] == 'me'
if issue_attributes && params[:conflict_resolution]
case params[:conflict_resolution]
when 'overwrite'
......@@ -522,6 +523,7 @@ class IssuesController < ApplicationController
# so we can use the default version for the new project
attrs.delete(:fixed_version_id)
end
attrs[:assigned_to_id] = User.current.id if attrs[:assigned_to_id] == 'me'
@issue.safe_attributes = attrs
if @issue.project
......
......@@ -2552,6 +2552,17 @@ class IssuesControllerTest < Redmine::ControllerTest
end
end
def test_new_with_me_assigned_to_id
@request.session[:user_id] = 2
get :new, :params => {
:issue => { :assigned_to_id => 'me' }
}
assert_response :success
assert_select 'select[name=?]', 'issue[assigned_to_id]' do
assert_select 'option[value="2"][selected=selected]'
end
end
def test_new_should_select_default_status
@request.session[:user_id] = 2
......@@ -4579,6 +4590,18 @@ class IssuesControllerTest < Redmine::ControllerTest
end
end
def test_get_edit_with_me_assigned_to_id
@request.session[:user_id] = 2
get :edit, :params => {
:id => 1,
:issue => { :assigned_to_id => 'me' }
}
assert_response :success
assert_select 'select[name=?]', 'issue[assigned_to_id]' do
assert_select 'option[value="2"][selected=selected]'
end
end
def test_update_form_for_existing_issue
@request.session[:user_id] = 2
patch :edit, :params => {
......@@ -5395,6 +5418,20 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_equal 'Original subject', issue.reload.subject
end
def test_update_with_me_assigned_to_id
@request.session[:user_id] = 2
issue = Issue.find(1)
assert_not_equal 2, issue.assigned_to_id
put :update, :params => {
:id => issue.id,
:issue => {
:assigned_to_id => 'me'
}
}
assert_response 302
assert_equal 2, issue.reload.assigned_to_id
end
def test_get_bulk_edit
@request.session[:user_id] = 2
get :bulk_edit, :params => {
......
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