1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

Fixed: Files assigned to a version can not be deleted if Issue Tracking module is disabled (#17163).

Patch by Michael Esemplare.

git-svn-id: http://svn.redmine.org/redmine/trunk@13390 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-09-13 10:17:15 +00:00
parent 34beae1c7a
commit e124da5488
2 changed files with 14 additions and 0 deletions

View File

@ -60,6 +60,10 @@ class Version < ActiveRecord::Base
project.present? && project.attachments_visible?(*args) project.present? && project.attachments_visible?(*args)
end end
def attachments_deletable?(usr=User.current)
project.present? && project.attachments_deletable?(usr)
end
def start_date def start_date
@start_date ||= fixed_issues.minimum('start_date') @start_date ||= fixed_issues.minimum('start_date')
end end

View File

@ -387,6 +387,16 @@ class AttachmentsControllerTest < ActionController::TestCase
end end
end end
def test_destroy_version_attachment_with_issue_tracking_disabled
Project.find(1).disable_module! :issue_tracking
set_tmp_attachments_directory
@request.session[:user_id] = 2
assert_difference 'Attachment.count', -1 do
delete :destroy, :id => 9
assert_response 302
end
end
def test_destroy_without_permission def test_destroy_without_permission
set_tmp_attachments_directory set_tmp_attachments_directory
assert_no_difference 'Attachment.count' do assert_no_difference 'Attachment.count' do