MS IZ added a check for person in webfinger response in receive_salmon method
This commit is contained in:
parent
a6d1906696
commit
34f190ce75
3 changed files with 33 additions and 32 deletions
40
Gemfile.lock
40
Gemfile.lock
|
|
@ -55,15 +55,6 @@ GIT
|
|||
carrierwave (0.5.0)
|
||||
activesupport (~> 3.0)
|
||||
|
||||
GIT
|
||||
remote: git://github.com/rsofaer/redfinger.git
|
||||
revision: 07721f46d02b9d3aa04880788fecb0b4c1b284d7
|
||||
specs:
|
||||
redfinger (0.0.6)
|
||||
hashie
|
||||
nokogiri (>= 1.4.0)
|
||||
rest-client (>= 1.5.0)
|
||||
|
||||
GIT
|
||||
remote: git://github.com/rsofaer/sprinkle.git
|
||||
revision: 7c744ed158dda1f99a015e6a29d086e80bd8c635
|
||||
|
|
@ -115,6 +106,7 @@ GEM
|
|||
activesupport (= 3.0.1)
|
||||
activesupport (3.0.1)
|
||||
addressable (2.2.2)
|
||||
archive-tar-minitar (0.5.2)
|
||||
arel (1.0.1)
|
||||
activesupport (~> 3.0.0)
|
||||
aws (2.3.24)
|
||||
|
|
@ -140,7 +132,6 @@ GEM
|
|||
rack (>= 1.0.0)
|
||||
rack-test (>= 0.5.4)
|
||||
selenium-webdriver (>= 0.0.3)
|
||||
cgi_multipart_eof_fix (2.5.0)
|
||||
chef (0.9.12)
|
||||
bunny (>= 0.6.0)
|
||||
erubis
|
||||
|
|
@ -192,10 +183,8 @@ GEM
|
|||
addressable (~> 2.2.2)
|
||||
multipart-post (~> 1.0.1)
|
||||
rack (>= 1.1.0, < 2)
|
||||
fastthread (1.0.7)
|
||||
ffi (0.6.3)
|
||||
rake (>= 0.8.7)
|
||||
gem_plugin (0.2.3)
|
||||
gherkin (2.2.9)
|
||||
json (~> 1.4.6)
|
||||
term-ansicolor (~> 1.0.5)
|
||||
|
|
@ -211,7 +200,8 @@ GEM
|
|||
launchy (0.3.7)
|
||||
configuration (>= 0.0.5)
|
||||
rake (>= 0.8.1)
|
||||
linecache (0.43)
|
||||
linecache19 (0.5.11)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
mail (2.2.9)
|
||||
activesupport (>= 2.3.6)
|
||||
i18n (~> 0.4.1)
|
||||
|
|
@ -233,11 +223,6 @@ GEM
|
|||
moneta (0.6.0)
|
||||
mongo (1.1)
|
||||
bson (>= 1.0.5)
|
||||
mongrel (1.1.5)
|
||||
cgi_multipart_eof_fix (>= 2.4)
|
||||
daemons (>= 1.0.3)
|
||||
fastthread (>= 1.0.1)
|
||||
gem_plugin (>= 0.2.3)
|
||||
multi_json (0.0.4)
|
||||
multipart-post (1.0.1)
|
||||
net-ldap (0.1.1)
|
||||
|
|
@ -332,14 +317,19 @@ GEM
|
|||
rspec-expectations (~> 2.0.1)
|
||||
rspec-rails (2.0.1)
|
||||
rspec (~> 2.0.0)
|
||||
ruby-debug (0.10.3)
|
||||
columnize (>= 0.1)
|
||||
ruby-debug-base (~> 0.10.3.0)
|
||||
ruby-debug-base (0.10.3)
|
||||
linecache (>= 0.3)
|
||||
ruby-debug-base19 (0.11.24)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
ruby-debug19 (0.11.6)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby-debug-base19 (>= 0.11.19)
|
||||
ruby-openid (2.1.8)
|
||||
ruby-openid-apps-discovery (1.2.0)
|
||||
ruby-openid (>= 2.1.7)
|
||||
ruby_core_source (0.1.4)
|
||||
archive-tar-minitar (>= 0.5.2)
|
||||
rubyntlm (0.1.1)
|
||||
rubyzip (0.9.4)
|
||||
selenium-client (1.2.18)
|
||||
|
|
@ -405,15 +395,13 @@ DEPENDENCIES
|
|||
mini_magick
|
||||
mocha
|
||||
mongo_mapper!
|
||||
mongrel
|
||||
omniauth
|
||||
pubsubhubbub
|
||||
rails (>= 3.0.0)
|
||||
redfinger!
|
||||
roxml!
|
||||
rspec (>= 2.0.0)
|
||||
rspec-rails (>= 2.0.0)
|
||||
ruby-debug
|
||||
ruby-debug19
|
||||
sprinkle!
|
||||
thin
|
||||
twitter
|
||||
|
|
|
|||
|
|
@ -7,10 +7,15 @@ module Diaspora
|
|||
salmon = Salmon::SalmonSlap.parse salmon_xml, self
|
||||
webfinger = EMWebfinger.new(salmon.author_email)
|
||||
|
||||
webfinger.on_person { |salmon_author|
|
||||
if salmon.verified_for_key?(salmon_author.public_key)
|
||||
Rails.logger.info("data in salmon: #{salmon.parsed_data}")
|
||||
self.receive(salmon.parsed_data, salmon_author)
|
||||
webfinger.on_person { |response|
|
||||
if response.is_a? Person
|
||||
salmon_author = response
|
||||
if salmon.verified_for_key?(salmon_author.public_key)
|
||||
Rails.logger.info("data in salmon: #{salmon.parsed_data}")
|
||||
self.receive(salmon.parsed_data, salmon_author)
|
||||
end
|
||||
else
|
||||
Rails.logger.info("#{salmon.author_email} not found error: #{response}")
|
||||
end
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ describe User do
|
|||
|
||||
let(:user3) { make_user }
|
||||
let(:aspect3) { user3.aspects.create(:name => 'heroes') }
|
||||
let(:status) {user.post(:status_message, :message => "Original", :to => aspect.id)}
|
||||
let(:album) {user.post(:album, :name => "Original", :to => aspect.id)}
|
||||
|
||||
before do
|
||||
friend_users(user, aspect, user2, aspect2)
|
||||
|
|
@ -49,9 +51,15 @@ describe User do
|
|||
user.aspects.size.should == num_aspects
|
||||
end
|
||||
|
||||
describe '#receive_salmon' do
|
||||
it 'should handle the case where the webfinger fails' do
|
||||
Person.should_receive(:by_account_identifier).and_return("not a person")
|
||||
|
||||
proc{user2.receive_salmon(user.salmon(status).xml_for(user2.person))}.should_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context 'update posts' do
|
||||
let(:status) {user.post(:status_message, :message => "Original", :to => aspect.id)}
|
||||
let(:album) {user.post(:album, :name => "Original", :to => aspect.id)}
|
||||
|
||||
it 'does not update posts not marked as mutable' do
|
||||
user2.receive_salmon(user.salmon(status).xml_for(user2.person))
|
||||
|
|
|
|||
Loading…
Reference in a new issue