author.diff

Marcin Świątkiewicz, 2017-01-17 08:34

Download (1.75 KB)

View differences:

app/controllers/issues_controller.rb
275 275
      @issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}}
276 276
    end
277 277

  
278
    @assignee_to_author = true if attributes['assigned_to_id'].present? && attributes['assigned_to_id'] == 'author'
279

  
278 280
    @issues.each do |orig_issue|
279 281
      orig_issue.reload
280 282
      if @copy
......
287 289
        issue = orig_issue
288 290
      end
289 291
      journal = issue.init_journal(User.current, params[:notes])
290
      if attributes['assigned_to_id'].present? && attributes['assigned_to_id'] == 'author'
292
      if @assignee_to_author
291 293
        attributes['assigned_to_id'] = issue.author_id
292 294
      end
293 295
      issue.safe_attributes = attributes
test/functional/issues_controller_test.rb
4204 4204
    Issue.where(id: [1, 2]).each {|i| assert_equal 2, i.assigned_to_id}
4205 4205
  end
4206 4206

  
4207
  def test_bulk_update_with_different_author
4208
    @request.session[:user_id] = 2
4209
    ids = Project.find(2).issues.map(&:id)
4210
    post :bulk_update, :ids => ids, :issue => {:project_id => '2', assigned_to_id: 'author'}
4211
    Project.find(2).issues.each {|i| assert_equal i.author_id, i.assigned_to_id}
4212
  end
4213

  
4207 4214
  def test_get_bulk_copy
4208 4215
    @request.session[:user_id] = 2
4209 4216
    get :bulk_edit, :ids => [1, 2, 3], :copy => '1'