mirror of
https://github.com/meineerde/redmine.git
synced 2026-04-02 22:11:38 +00:00
Fix that deleting a version silently deletes its attachments (#31087).
Patch by Karel Pičman and Takenori TAKAKI. git-svn-id: http://svn.redmine.org/redmine/trunk@18008 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
391c069d87
commit
f0d579adeb
@ -353,7 +353,7 @@ class Version < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def deletable?
|
def deletable?
|
||||||
fixed_issues.empty? && !referenced_by_a_custom_field?
|
fixed_issues.empty? && !referenced_by_a_custom_field? && attachments.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_project_version
|
def default_project_version
|
||||||
|
|||||||
@ -284,6 +284,13 @@ class VersionTest < ActiveSupport::TestCase
|
|||||||
assert_equal false, version.deletable?
|
assert_equal false, version.deletable?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_deletable_should_return_false_when_referenced_by_an_attachment
|
||||||
|
version = Version.generate!
|
||||||
|
Attachment.generate!(:container => version, :filename => 'test.txt')
|
||||||
|
|
||||||
|
assert_equal false, version.deletable?
|
||||||
|
end
|
||||||
|
|
||||||
def test_like_scope
|
def test_like_scope
|
||||||
version = Version.create!(:project => Project.find(1), :name => 'Version for like scope test')
|
version = Version.create!(:project => Project.find(1), :name => 'Version for like scope test')
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user