parent
99b36598c7
commit
d42b5c128e
5 changed files with 48 additions and 1 deletions
|
|
@ -28,6 +28,7 @@
|
|||
* Improved logging source [#6041](https://github.com/diaspora/diaspora/pull/6041)
|
||||
* Gracefully handle duplicate entry while receiving share-visibility in parallel [#6068](https://github.com/diaspora/diaspora/pull/6068)
|
||||
* Update twitter gem to get rid of deprecation warnings [#6083](https://github.com/diaspora/diaspora/pull/6083)
|
||||
* Refactor photos federation to get rid of some hacks [#6082](https://github.com/diaspora/diaspora/pull/6082)
|
||||
|
||||
## Bug fixes
|
||||
* Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846)
|
||||
|
|
@ -60,6 +61,7 @@
|
|||
* Only strip text direction codepoints around hashtags [#6067](https://github.com/diaspora/diaspora/issues/6067)
|
||||
* Fix selected week on admin weekly stats page [#6079](https://github.com/diaspora/diaspora/pull/6079)
|
||||
* Fix that some unread conversations may be hidden [#6060](https://github.com/diaspora/diaspora/pull/6060)
|
||||
* Fix photo links in the mobile interface [#6082](https://github.com/diaspora/diaspora/pull/6082)
|
||||
|
||||
## Features
|
||||
* Hide post title of limited post in comment notification email [#5843](https://github.com/diaspora/diaspora/pull/5843)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,16 @@ module Diaspora
|
|||
end
|
||||
end
|
||||
|
||||
# @return [void]
|
||||
def receive_public
|
||||
local_shareable = persisted_shareable
|
||||
if local_shareable
|
||||
update_existing_sharable(local_shareable) if verify_persisted_shareable(local_shareable)
|
||||
else
|
||||
save!
|
||||
end
|
||||
end
|
||||
|
||||
# The list of people that should receive this Shareable.
|
||||
#
|
||||
# @param [User] user The context, or dispatching user.
|
||||
|
|
|
|||
|
|
@ -61,7 +61,11 @@ class Postzord::Receiver::Public < Postzord::Receiver
|
|||
|
||||
# @return [void]
|
||||
def receive_object
|
||||
@object.save! if @object.respond_to?(:save!)
|
||||
if @object.respond_to?(:receive_public)
|
||||
@object.receive_public
|
||||
elsif @object.respond_to?(:save!)
|
||||
@object.save!
|
||||
end
|
||||
end
|
||||
|
||||
# @return [Array<Integer>] User ids
|
||||
|
|
|
|||
|
|
@ -277,4 +277,19 @@ describe Photo, :type => :model do
|
|||
}.to_not change(StatusMessage, :count)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#receive_public" do
|
||||
it "updates the photo if it is already persisted" do
|
||||
allow(@photo).to receive(:persisted_shareable).and_return(@photo2)
|
||||
expect(@photo2).to receive(:update_attributes)
|
||||
@photo.receive_public
|
||||
end
|
||||
|
||||
it "does not update the photo if the author mismatches" do
|
||||
@photo.author = bob.person
|
||||
allow(@photo).to receive(:persisted_shareable).and_return(@photo2)
|
||||
expect(@photo).not_to receive(:update_existing_sharable)
|
||||
@photo.receive_public
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -336,6 +336,22 @@ describe Post, :type => :model do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#receive_public" do
|
||||
it "saves the post if the post is unknown" do
|
||||
@post = FactoryGirl.create(:status_message, author: bob.person)
|
||||
allow(@post).to receive(:persisted_shareable).and_return(nil)
|
||||
expect(@post).to receive(:save!)
|
||||
@post.receive_public
|
||||
end
|
||||
|
||||
it "does not update the post because not mutable" do
|
||||
@post = FactoryGirl.create(:status_message, author: bob.person)
|
||||
expect(@post).to receive(:update_existing_sharable).and_call_original
|
||||
expect(@post).not_to receive(:update_attributes)
|
||||
@post.receive_public
|
||||
end
|
||||
end
|
||||
|
||||
describe '#reshares_count' do
|
||||
before :each do
|
||||
@post = @user.post :status_message, :text => "hello", :to => @aspect.id, :public => true
|
||||
|
|
|
|||
Loading…
Reference in a new issue