]> source.dussan.org Git - redmine.git/commitdiff
Fixed: Files assigned to a version can not be deleted if Issue Tracking module is...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 13 Sep 2014 10:17:15 +0000 (10:17 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 13 Sep 2014 10:17:15 +0000 (10:17 +0000)
Patch by Michael Esemplare.

git-svn-id: http://svn.redmine.org/redmine/trunk@13390 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index 76853e4b03ff524a357aee35c079764819f429a6..1d06360ef67a53bb20114bfaa65dd0bc0049f1ad 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 068d8432158249dce464107a143e5daf4b9ff519..018f848d9cbf4672a848e70ee05b48ccf5327529 100644 (file)
@@ -387,6 +387,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