Merge branch 'master' of github.com:diaspora/diaspora

This commit is contained in:
danielvincent 2010-08-26 15:02:29 -07:00
commit 1d515e7b7e
5 changed files with 9 additions and 7 deletions

View file

@ -29,7 +29,6 @@ class PublicsController < ApplicationController
Rails.logger.error("Received post #{params[:xml]} for nonexistent person #{params[:id]}") Rails.logger.error("Received post #{params[:xml]} for nonexistent person #{params[:id]}")
return return
end end
Rails.logger.debug "PublicsController has received: #{params[:xml]}"
@user.receive params[:xml] if params[:xml] @user.receive params[:xml] if params[:xml]
end end

View file

@ -58,9 +58,7 @@ class Comment
end end
def signature_valid? def signature_valid?
Rails.logger.warn "Received comment has person #{person.inspect}" verify_signature(creator_signature, person)
Rails.logger.warn "Received comment has person key #{person.serialized_key}" if person
verify_signature(creator_signature, person) && verify_signature(post_creator_signator, post.person)
end end
protected protected

View file

@ -21,7 +21,7 @@ class Group
end end
def posts_by_person_id( id ) def posts_by_person_id( id )
id = ensure_bson id id = id.to_id
posts.detect{|x| x.person.id == id } posts.detect{|x| x.person.id == id }
end end
end end

View file

@ -51,7 +51,7 @@ class User
puts posts_to_move.inspect puts posts_to_move.inspect
to_group.people << friend to_group.people << friend
to_group.posts << posts_to_move to_group.posts << posts_to_move
from_group.person_ids.delete(ensure_bson(friend.id)) from_group.person_ids.delete(friend.id.to_id)
posts_to_move.each{ |x| from_group.post_ids.delete(x.id)} posts_to_move.each{ |x| from_group.post_ids.delete(x.id)}
from_group.save from_group.save
to_group.save to_group.save
@ -166,7 +166,9 @@ class User
def receive xml def receive xml
object = Diaspora::Parser.from_xml(xml) object = Diaspora::Parser.from_xml(xml)
Rails.logger.debug("Receiving object:\n#{object.inspect}") Rails.logger.debug("Receiving object:\n#{object.inspect}")
raise "Signature was not valid on: #{object.inspect}" unless object.signature_valid? Rails.logger.debug("From: #{object.person.inspect}") if object.person
object.person.save if object.is_a?(Comment) && Person.find_by_id(object.person_id).nil?
raise "In receive for #{self.real_name}, signature was not valid on: #{object.inspect}" unless object.signature_valid?
if object.is_a? Retraction if object.is_a? Retraction
if object.type == 'Person' && object.signature_valid? if object.type == 'Person' && object.signature_valid?
@ -195,6 +197,8 @@ class User
person.save person.save
elsif object.is_a?(Comment) elsif object.is_a?(Comment)
raise "In receive for #{self.real_name}, signature was not valid on: #{object.inspect}" unless object.post.person == self.person || object.verify_post_creator_signature
object.save
dispatch_comment object unless owns?(object) dispatch_comment object unless owns?(object)
object.socket_to_uid(id) if (object.respond_to?(:socket_to_uid) && !self.owns?(object)) object.socket_to_uid(id) if (object.respond_to?(:socket_to_uid) && !self.owns?(object))
else else

View file

@ -16,6 +16,7 @@
stuff stuff
-for person in group.people -for person in group.people
%li.person %li.person
= image_tag (person.profile.image_url(:thumb_small),:size => "30x30") unless person.profile.image_url.nil?
= person.real_name = person.real_name