]> source.dussan.org Git - redmine.git/commitdiff
Merged r13390 (#17163).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 14 Sep 2014 09:20:19 +0000 (09:20 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 14 Sep 2014 09:20:19 +0000 (09:20 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/2.5-stable@13397 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/version.rb
test/functional/attachments_controller_test.rb

index 02061c548c056f4349a38a53a3d31ecebfdba0ca..2d1a8518a189fd1e12ec371d24cc5fc35e86d6cb 100644 (file)
@@ -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
index 5800307620a54533beac422feac95ac41b2a0da6..63d1423b193740df303bb83ef431df28203c3fbb 100644 (file)
@@ -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