fix attachment_removal
This commit is contained in:
parent
aaecab6d7f
commit
485335599a
@ -315,6 +315,13 @@ class Issue < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Callback on attachment deletion
|
||||||
|
def attachment_removed(obj)
|
||||||
|
init_journal(User.current)
|
||||||
|
create_journal
|
||||||
|
last_journal.update_attribute(:changes, {obj.id => [obj.filename, nil]}.to_yaml)
|
||||||
|
end
|
||||||
|
|
||||||
# Return true if the issue is closed, otherwise false
|
# Return true if the issue is closed, otherwise false
|
||||||
def closed?
|
def closed?
|
||||||
self.status.is_closed?
|
self.status.is_closed?
|
||||||
|
@ -97,10 +97,9 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||||||
# no referrer
|
# no referrer
|
||||||
assert_redirected_to 'projects/ecookbook'
|
assert_redirected_to 'projects/ecookbook'
|
||||||
assert_nil Attachment.find_by_id(1)
|
assert_nil Attachment.find_by_id(1)
|
||||||
j = issue.journals.find(:first, :order => 'created_on DESC')
|
j = issue.journals.find(:first, :order => 'created_at DESC')
|
||||||
assert_equal 'attachment', j.details.first.property
|
assert_equal [1], j.details.keys
|
||||||
assert_equal '1', j.details.first.prop_key
|
assert_equal 'error281.txt', j.details[1].first
|
||||||
assert_equal 'error281.txt', j.details.first.old_value
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy_wiki_page_attachment
|
def test_destroy_wiki_page_attachment
|
||||||
|
Loading…
x
Reference in New Issue
Block a user