Merge branch 'stable' into develop
This commit is contained in:
commit
13b69f81d1
7 changed files with 64 additions and 11 deletions
|
|
@ -56,6 +56,7 @@ Ruby 2.0 is no longer officially supported.
|
||||||
* Add a button to follow/unfollow tags to the mobile interface [#5941](https://github.com/diaspora/diaspora/pull/5941)
|
* Add a button to follow/unfollow tags to the mobile interface [#5941](https://github.com/diaspora/diaspora/pull/5941)
|
||||||
* Add a "Manage followed tags" page to mass unfollow tags in the mobile interface [#5945](https://github.com/diaspora/diaspora/pull/5945)
|
* Add a "Manage followed tags" page to mass unfollow tags in the mobile interface [#5945](https://github.com/diaspora/diaspora/pull/5945)
|
||||||
* Add popover/tooltip about email visibility to registration/settings page [#5956](https://github.com/diaspora/diaspora/pull/5956)
|
* Add popover/tooltip about email visibility to registration/settings page [#5956](https://github.com/diaspora/diaspora/pull/5956)
|
||||||
|
* Fetch person posts on sharing request [#5960](https://github.com/diaspora/diaspora/pull/5960)
|
||||||
|
|
||||||
# 0.5.0.1
|
# 0.5.0.1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ module Workers
|
||||||
person = Webfinger.new(account).fetch
|
person = Webfinger.new(account).fetch
|
||||||
|
|
||||||
# also, schedule to fetch a few public posts from that person
|
# also, schedule to fetch a few public posts from that person
|
||||||
Workers::FetchPublicPosts.perform_async(person.diaspora_handle) unless person.nil?
|
Diaspora::Fetcher::Public.queue_for(person) unless person.nil?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,9 @@ class Request
|
||||||
|
|
||||||
user.share_with(person, user.auto_follow_back_aspect) if user.auto_follow_back && !contact.receiving
|
user.share_with(person, user.auto_follow_back_aspect) if user.auto_follow_back && !contact.receiving
|
||||||
|
|
||||||
|
# also, schedule to fetch a few public posts from that person
|
||||||
|
Diaspora::Fetcher::Public.queue_for(person)
|
||||||
|
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,10 @@ module Diaspora; module Fetcher; class Public
|
||||||
Status_Failed = 5
|
Status_Failed = 5
|
||||||
Status_Unfetchable = 6
|
Status_Unfetchable = 6
|
||||||
|
|
||||||
|
def self.queue_for(person)
|
||||||
|
Workers::FetchPublicPosts.perform_async(person.diaspora_handle) unless person.fetch_status > Status_Initial
|
||||||
|
end
|
||||||
|
|
||||||
# perform all actions necessary to fetch the public posts of a person
|
# perform all actions necessary to fetch the public posts of a person
|
||||||
# with the given diaspora_id
|
# with the given diaspora_id
|
||||||
def fetch! diaspora_id
|
def fetch! diaspora_id
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,13 @@ describe Request do
|
||||||
described_class.diaspora_initialize(:from => eve.person, :to => alice.person,
|
described_class.diaspora_initialize(:from => eve.person, :to => alice.person,
|
||||||
:into => eve.aspects.first).receive(alice, eve.person)
|
:into => eve.aspects.first).receive(alice, eve.person)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "queue a job to fetch public posts" do
|
||||||
|
expect(Diaspora::Fetcher::Public).to receive(:queue_for).exactly(1).times
|
||||||
|
|
||||||
|
described_class.diaspora_initialize(from: eve.person, to: alice.person,
|
||||||
|
into: eve.aspects.first).receive(alice, eve.person)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'xml' do
|
context 'xml' do
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,24 @@ describe Diaspora::Fetcher::Public do
|
||||||
}).to_return(:body => @fixture)
|
}).to_return(:body => @fixture)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#queue_for" do
|
||||||
|
it "queues a new job" do
|
||||||
|
@person.fetch_status = Diaspora::Fetcher::Public::Status_Initial
|
||||||
|
|
||||||
|
expect(Workers::FetchPublicPosts).to receive(:perform_async).with(@person.diaspora_handle)
|
||||||
|
|
||||||
|
Diaspora::Fetcher::Public.queue_for(@person)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "queues no job if the status is not initial" do
|
||||||
|
@person.fetch_status = Diaspora::Fetcher::Public::Status_Done
|
||||||
|
|
||||||
|
expect(Workers::FetchPublicPosts).not_to receive(:perform_async).with(@person.diaspora_handle)
|
||||||
|
|
||||||
|
Diaspora::Fetcher::Public.queue_for(@person)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#retrieve_posts" do
|
describe "#retrieve_posts" do
|
||||||
before do
|
before do
|
||||||
person = @person
|
person = @person
|
||||||
|
|
|
||||||
20
spec/workers/fetch_webfinger_spec.rb
Normal file
20
spec/workers/fetch_webfinger_spec.rb
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
require "spec_helper"
|
||||||
|
|
||||||
|
describe Workers::FetchWebfinger do
|
||||||
|
it "should webfinger and queue a job to fetch public posts" do
|
||||||
|
@person = FactoryGirl.create(:person)
|
||||||
|
allow(Webfinger).to receive(:new).and_return(double(fetch: @person))
|
||||||
|
|
||||||
|
expect(Diaspora::Fetcher::Public).to receive(:queue_for).exactly(1).times
|
||||||
|
|
||||||
|
Workers::FetchWebfinger.new.perform(@person.diaspora_handle)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should webfinger and queue no job to fetch public posts if the person is not found" do
|
||||||
|
allow(Webfinger).to receive(:new).and_return(double(fetch: nil))
|
||||||
|
|
||||||
|
expect(Diaspora::Fetcher::Public).not_to receive(:queue_for)
|
||||||
|
|
||||||
|
Workers::FetchWebfinger.new.perform("unknown-person@example.net")
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue