fixing N socketing bug
This commit is contained in:
parent
07c216f31b
commit
b19cdf2e25
2 changed files with 16 additions and 9 deletions
|
|
@ -20,7 +20,6 @@ module Diaspora
|
|||
Rails.logger.debug("Receiving object for #{self.real_name}:\n#{object.inspect}")
|
||||
Rails.logger.debug("From: #{object.person.inspect}") if object.person
|
||||
|
||||
|
||||
if object.is_a?(Comment) || object.is_a?(Post)
|
||||
e = EMWebfinger.new(object.diaspora_handle)
|
||||
|
||||
|
|
@ -137,11 +136,11 @@ module Diaspora
|
|||
self.save
|
||||
|
||||
aspects = self.aspects_with_person(post.person)
|
||||
aspects.each{ |aspect|
|
||||
aspects.each do |aspect|
|
||||
aspect.posts << post
|
||||
aspect.save
|
||||
post.socket_to_uid(id, :aspect_ids => [aspect.id]) if (post.respond_to?(:socket_to_uid) && !self.owns?(post))
|
||||
}
|
||||
end
|
||||
post.socket_to_uid(id, :aspect_ids => aspects.map(&:id)) if (post.respond_to?(:socket_to_uid) && !self.owns?(post))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,6 +19,14 @@ describe User do
|
|||
friend_users(user, aspect, user2, aspect2)
|
||||
end
|
||||
|
||||
it 'should stream only one message to the everyone aspect when a multi-aspected friend posts' do
|
||||
user.add_person_to_aspect(user2.person.id, user.aspect(:name => "villains").id)
|
||||
status = user2.post(:status_message, :message => "Users do things", :to => aspect2.id)
|
||||
xml = status.to_diaspora_xml
|
||||
Diaspora::WebSocket.should_receive(:queue_to_user).exactly(:once)
|
||||
user.receive xml, user2.person
|
||||
end
|
||||
|
||||
it 'should be able to parse and store a status message from xml' do
|
||||
status_message = user2.post :status_message, :message => 'store this!', :to => aspect2.id
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue