fix #2698; allow a user to delete a reshare of a deleted post
This commit is contained in:
parent
838da1fd52
commit
0ce0e47ff8
2 changed files with 12 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue