From b2dcaed5e2bd017bd6ddbbb0442adc86213dea54 Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 22 Jul 2010 12:07:18 -0700 Subject: [PATCH 1/4] RS IZ saving in the photo parsing --- app/models/photo.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/photo.rb b/app/models/photo.rb index 5a5dd1c90..0115d9af0 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -29,5 +29,6 @@ class Photo < Post def remote_photo= remote_path image.download! remote_path image.store! + save end end From 065c790e4e6cab92571059010581125df06a61de Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 22 Jul 2010 12:23:18 -0700 Subject: [PATCH 2/4] not saving in photo receive and logging the saving in common --- app/models/photo.rb | 1 - lib/common.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/photo.rb b/app/models/photo.rb index 0115d9af0..5a5dd1c90 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -29,6 +29,5 @@ class Photo < Post def remote_photo= remote_path image.download! remote_path image.store! - save end end diff --git a/lib/common.rb b/lib/common.rb index 7fd24eb6e..be129d051 100644 --- a/lib/common.rb +++ b/lib/common.rb @@ -51,7 +51,7 @@ module Diaspora User.owner.receive_friend_request(p) #This line checks if the sender was in the database, among other things? elsif p.respond_to?(:person) && !(p.person.nil?) && !(p.person.is_a? User) #WTF - p.save + Rails.logger.info("Saving object with success: #{p.save}") end #p.save if p.respond_to?(:person) && !(p.person == nil) #WTF end From 108ec865935d44d6e8b3ad8d4b2e9507e1456232 Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 22 Jul 2010 12:34:06 -0700 Subject: [PATCH 3/4] Adding logging to signing and verifying --- lib/encryptable.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/encryptable.rb b/lib/encryptable.rb index cc5682f95..7cbbfe764 100644 --- a/lib/encryptable.rb +++ b/lib/encryptable.rb @@ -10,6 +10,7 @@ def verify_signature(signature, person) return false unless signature && person.key_fingerprint validity = nil + Rails.logger.info("Verifying sig on #{signable_string} from person #{person.real_name}") GPGME::verify(signature, signable_string, {:armor => true, :always_trust => true}){ |signature_analysis| puts signature_analysis @@ -31,6 +32,7 @@ end def sign_with_key(key) + Rails.logger.info("Signing #{signable_string} with key for person #{self.person.real_name}") GPGME::sign(signable_string,nil, {:armor=> true, :mode => GPGME::SIG_MODE_DETACH, :signers => [key]}) end From 7df902b9db6d0033e4521b472c2b4f005243fe91 Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 22 Jul 2010 12:39:53 -0700 Subject: [PATCH 4/4] XML reader was assuming photos were local --- app/models/photo.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/photo.rb b/app/models/photo.rb index 5a5dd1c90..8521c5597 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -3,7 +3,7 @@ class Photo < Post include MongoMapper::Document mount_uploader :image, ImageUploader - xml_reader :remote_photo + xml_accessor :remote_photo xml_reader :album_id key :album_id, ObjectId @@ -23,10 +23,11 @@ class Photo < Post end def remote_photo - User.owner.url.chop + image.url + @remote_photo ||= User.owner.url.chop + image.url end def remote_photo= remote_path + @remote_photo = remote_path image.download! remote_path image.store! end