delegate parent_author to the target of a RelayableRetraction
This commit is contained in:
parent
df1abefc1c
commit
ccedb6eff0
3 changed files with 24 additions and 10 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|
||||||
* avoid posting empty comments. [#3836](https://github.com/diaspora/diaspora/issues/3836)
|
* avoid posting empty comments. [#3836](https://github.com/diaspora/diaspora/issues/3836)
|
||||||
|
* Delegate parent_author to the target of a RelayableRetraction
|
||||||
|
|
||||||
## Refactor
|
## Refactor
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ class RelayableRetraction < SignedRetraction
|
||||||
|
|
||||||
attr_accessor :parent_author_signature
|
attr_accessor :parent_author_signature
|
||||||
|
|
||||||
|
delegate :parent, :parent_author, to: :target, allow_nil: true
|
||||||
|
|
||||||
def signable_accessors
|
def signable_accessors
|
||||||
super - ['parent_author_signature']
|
super - ['parent_author_signature']
|
||||||
end
|
end
|
||||||
|
|
@ -20,11 +22,6 @@ class RelayableRetraction < SignedRetraction
|
||||||
retraction
|
retraction
|
||||||
end
|
end
|
||||||
|
|
||||||
def parent
|
|
||||||
return nil unless self.target.present?
|
|
||||||
self.target.parent
|
|
||||||
end
|
|
||||||
|
|
||||||
def diaspora_handle
|
def diaspora_handle
|
||||||
self.sender_handle
|
self.sender_handle
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,18 +12,34 @@ describe RelayableRetraction do
|
||||||
@local_parent = @local_luke.post :status_message, :text => "hi", :to => @local_luke.aspects.first
|
@local_parent = @local_luke.post :status_message, :text => "hi", :to => @local_luke.aspects.first
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#subscribers' do
|
context "when retracting a comment" do
|
||||||
before do
|
before do
|
||||||
@comment= @local_luke.comment!(@local_parent, "yo")
|
@comment= @local_luke.comment!(@local_parent, "yo")
|
||||||
@retraction= @local_luke.retract(@comment)
|
@retraction= @local_luke.retract(@comment)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#parent" do
|
||||||
|
it "delegates to to target" do
|
||||||
|
@retraction.target.should_receive(:parent)
|
||||||
|
@retraction.parent
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#parent_author" do
|
||||||
|
it "delegates to target" do
|
||||||
|
@retraction.target.should_receive(:parent_author)
|
||||||
|
@retraction.parent_author
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#subscribers' do
|
||||||
it 'delegates it to target' do
|
it 'delegates it to target' do
|
||||||
arg = mock()
|
arg = mock()
|
||||||
@retraction.target.should_receive(:subscribers).with(arg)
|
@retraction.target.should_receive(:subscribers).with(arg)
|
||||||
@retraction.subscribers(arg)
|
@retraction.subscribers(arg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#receive' do
|
describe '#receive' do
|
||||||
it 'discards a retraction with a nil target' do
|
it 'discards a retraction with a nil target' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue