Merge branch 'friend-refactor' of github.com:diaspora/diaspora_rails into friend-refactor

This commit is contained in:
Raphael 2010-08-10 16:03:54 -07:00
commit a9ebe44b1d
6 changed files with 12 additions and 12 deletions

View file

@ -5,9 +5,9 @@ module SocketsHelper
(object.is_a? Post) ? object.id : object.post_id
end
def url_options
{:host => ""}
end
#def url_options
# {:host => ""}
#end
def action_hash(uid, object)
begin

View file

@ -109,8 +109,8 @@ class Person
self.id == post.person.id
end
def recieve_url
"#{self.url}user/#{self.owner.id}"
def receive_url
"#{self.url}receive/users/#{self.id}/"
end
protected

View file

@ -25,12 +25,12 @@ class Request
before_validation :clean_link
scope :for_user, lambda{ |user| where(:destination_url => user.url) }
scope :from_user, lambda{ |user| where(:destination_url.ne => user.url) }
scope :for_user, lambda{ |user| where(:destination_url => user.receive_url) }
scope :from_user, lambda{ |user| where(:destination_url.ne => user.receive_url) }
def self.instantiate(options = {})
person = options[:from]
self.new(:destination_url => options[:to], :callback_url => person.url, :person => person, :exported_key => person.export_key)
self.new(:destination_url => options[:to], :callback_url => person.receive_url, :person => person, :exported_key => person.export_key)
end

View file

@ -97,7 +97,7 @@ class User
self.save
if bad_friend
Retraction.for(self).push_to_url(bad_friend.url)
Retraction.for(self).push_to_url(bad_friend.receive_url)
bad_friend.update_attributes(:user_refs => bad_friend.user_refs - 1)
bad_friend.destroy if bad_friend.user_refs == 0
end

View file

@ -1,9 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
xmlns:hm='http://host-meta.net/xrd/1.0'>
<hm:Host><%= terse_url(root_path) %></hm:Host>
<hm:Host><%= terse_url(root_url) %></hm:Host>
<Link rel='lrdd'
template='<%= root_path %>webfinger?q={uri}'>
template='<%= root_url %>webfinger?q={uri}'>
<Title>Resource Descriptor</Title>
</Link>
</XRD>

View file

@ -27,7 +27,7 @@ module Diaspora
end
def push_to_url(url)
hook_url = url + "receive/"
hook_url = url
xml = self.class.build_xml_for(self)
Rails.logger.debug("Adding xml for #{self} to message queue to #{url}")
@@queue.add_post_request( hook_url, xml )