Project

General

Profile

Defect #33744 ยป 0001-Allow-unassigning-an-issue-via-the-REST-API-with-a-n.patch

Go MAEDA, 2026-11-03 09:20

View differences:

app/models/issue.rb
!attrs.key?('is_private') && safe_attribute?('is_private', user)
attrs['is_private'] = '1'
end
if (u = attrs.delete('assigned_to_id')) && safe_attribute?('assigned_to_id')
self.assigned_to_id = u
if attrs.key?('assigned_to_id')
assigned_to_id = attrs.delete('assigned_to_id')
self.assigned_to_id = assigned_to_id if safe_attribute?('assigned_to_id')
end
attrs = delete_unsafe_attributes(attrs, user)
return if attrs.empty?
test/integration/api_test/issues_test.rb
assert_select 'errors error', :text => "Assignee is invalid"
end
test "PUT /issues/:id.xml with empty assignee should unassign the issue" do
put(
'/issues/2.xml',
:params => '<issue><assigned_to_id/></issue>',
:headers => {'CONTENT_TYPE' => 'application/xml'}.merge(credentials('jsmith')))
assert_response :no_content
assert_nil Issue.find(2).assigned_to_id
end
test "PUT /issues/:id.json with null assignee should unassign the issue" do
put(
'/issues/2.json',
:params => {:issue => {:assigned_to_id => nil}}.to_json,
:headers => {'CONTENT_TYPE' => 'application/json'}.merge(credentials('jsmith')))
assert_response :no_content
assert_nil Issue.find(2).assigned_to_id
end
test "PUT /issues/:id.json" do
assert_difference('Journal.count') do
put(
    (1-1/1)