Project

General

Profile

Defect #17163 ยป 0001-Fixes-Files-assigned-to-a-version-can-not-be-deleted.patch

Michael Esemplare, 2014-08-15 03:59

View differences:

app/models/version.rb
60 60
    project.present? && project.attachments_visible?(*args)
61 61
  end
62 62

  
63
  def attachments_deletable?(usr=User.current)
64
    project.present? && project.attachments_deletable?(usr)
65
  end
66

  
63 67
  def start_date
64 68
    @start_date ||= fixed_issues.minimum('start_date')
65 69
  end
test/functional/attachments_controller_test.rb
387 387
    end
388 388
  end
389 389

  
390
  def test_destroy_version_attachment_with_issue_tracking_disabled
391
    Project.find(1).disable_module! :issue_tracking
392
    set_tmp_attachments_directory
393
    @request.session[:user_id] = 2
394
    assert_difference 'Attachment.count', -1 do
395
      delete :destroy, :id => 9
396
      assert_response 302
397
    end
398
  end
399

  
390 400
  def test_destroy_without_permission
391 401
    set_tmp_attachments_directory
392 402
    assert_no_difference 'Attachment.count' do
    (1-1/1)