fix #2698; allow a user to delete a reshare of a deleted post

This commit is contained in:
Maxwell Salzberg 2012-01-19 15:24:07 -08:00
parent 838da1fd52
commit 0ce0e47ff8
2 changed files with 12 additions and 1 deletions

View file

@ -22,7 +22,7 @@ class Reshare < Post
end
after_destroy do
self.root.update_reshares_counter
self.root.update_reshares_counter if self.root.present?
end
def root_diaspora_id

View file

@ -105,6 +105,17 @@ describe Reshare do
end
end
describe 'destroy' do
it 'allows you to destroy the reshare if the root post is missing' do
reshare = Factory(:reshare)
reshare.root = nil
expect{
reshare.destroy
}.should_not raise_error
end
end
context 'remote' do
before do
@root_object = @reshare.root