send the profile to remote persons on start shareing with them
This commit is contained in:
parent
c15babdc9f
commit
0f6e0b7288
4 changed files with 15 additions and 7 deletions
|
|
@ -394,8 +394,8 @@ class User < ActiveRecord::Base
|
||||||
update_profile( self.profile.from_omniauth_hash( user_info ) )
|
update_profile( self.profile.from_omniauth_hash( user_info ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
def deliver_profile_update
|
def deliver_profile_update(opts={})
|
||||||
Diaspora::Federation::Dispatcher.defer_dispatch(self, profile)
|
Diaspora::Federation::Dispatcher.defer_dispatch(self, profile, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
def basic_profile_present?
|
def basic_profile_present?
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ class User
|
||||||
|
|
||||||
if needs_dispatch
|
if needs_dispatch
|
||||||
Diaspora::Federation::Dispatcher.defer_dispatch(self, contact)
|
Diaspora::Federation::Dispatcher.defer_dispatch(self, contact)
|
||||||
|
deliver_profile_update(subscriber_ids: [person.id]) unless person.local?
|
||||||
end
|
end
|
||||||
|
|
||||||
Notifications::StartedSharing.where(recipient_id: id, target: person.id, unread: true)
|
Notifications::StartedSharing.where(recipient_id: id, target: person.id, unread: true)
|
||||||
.update_all(unread: false)
|
.update_all(unread: false)
|
||||||
|
|
||||||
deliver_profile_update
|
|
||||||
contact
|
contact
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -167,9 +167,17 @@ describe User::Connecting, type: :model do
|
||||||
alice.share_with(eve.person, aspect2)
|
alice.share_with(eve.person, aspect2)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "posts profile" do
|
it "delivers profile for remote persons" do
|
||||||
allow(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch)
|
allow(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch)
|
||||||
expect(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch).with(alice, alice.profile)
|
expect(Diaspora::Federation::Dispatcher)
|
||||||
|
.to receive(:defer_dispatch).with(alice, alice.profile, subscriber_ids: [remote_raphael.id])
|
||||||
|
|
||||||
|
alice.share_with(remote_raphael, alice.aspects.first)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "does not deliver profile for remote persons" do
|
||||||
|
allow(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch)
|
||||||
|
expect(Diaspora::Federation::Dispatcher).not_to receive(:defer_dispatch).with(alice, alice.profile, anything)
|
||||||
|
|
||||||
alice.share_with(eve.person, alice.aspects.first)
|
alice.share_with(eve.person, alice.aspects.first)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -494,12 +494,12 @@ describe User, :type => :model do
|
||||||
|
|
||||||
it "dispatches the profile when tags are set" do
|
it "dispatches the profile when tags are set" do
|
||||||
@params = {tag_string: '#what #hey'}
|
@params = {tag_string: '#what #hey'}
|
||||||
expect(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch).with(alice, alice.profile)
|
expect(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch).with(alice, alice.profile, {})
|
||||||
expect(alice.update_profile(@params)).to be true
|
expect(alice.update_profile(@params)).to be true
|
||||||
end
|
end
|
||||||
|
|
||||||
it "sends a profile to their contacts" do
|
it "sends a profile to their contacts" do
|
||||||
expect(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch).with(alice, alice.profile)
|
expect(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch).with(alice, alice.profile, {})
|
||||||
expect(alice.update_profile(@params)).to be true
|
expect(alice.update_profile(@params)).to be true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue