diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-09-14 09:20:19 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-09-14 09:20:19 +0000 |
commit | 198e92d26b499d081a80350c00c080bd4922f12a (patch) | |
tree | 252a911060d02d74d62d28b7d9160130f033be86 | |
parent | 5f184f9fd1da198d0dcda5ee38fbb62dd4ab7237 (diff) | |
download | redmine-198e92d26b499d081a80350c00c080bd4922f12a.tar.gz redmine-198e92d26b499d081a80350c00c080bd4922f12a.zip |
Merged r13390 (#17163).
git-svn-id: http://svn.redmine.org/redmine/branches/2.5-stable@13397 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/version.rb | 4 | ||||
-rw-r--r-- | test/functional/attachments_controller_test.rb | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/app/models/version.rb b/app/models/version.rb index 02061c548..2d1a8518a 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -60,6 +60,10 @@ class Version < ActiveRecord::Base project.present? && project.attachments_visible?(*args) end + def attachments_deletable?(usr=User.current) + project.present? && project.attachments_deletable?(usr) + end + def start_date @start_date ||= fixed_issues.minimum('start_date') end diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb index 580030762..63d1423b1 100644 --- a/test/functional/attachments_controller_test.rb +++ b/test/functional/attachments_controller_test.rb @@ -374,6 +374,16 @@ class AttachmentsControllerTest < ActionController::TestCase 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 set_tmp_attachments_directory assert_no_difference 'Attachment.count' do |