Merge branch 'friend-refactor' of github.com:diaspora/diaspora_rails into friend-refactor
This commit is contained in:
commit
a9ebe44b1d
6 changed files with 12 additions and 12 deletions
|
|
@ -5,9 +5,9 @@ module SocketsHelper
|
||||||
(object.is_a? Post) ? object.id : object.post_id
|
(object.is_a? Post) ? object.id : object.post_id
|
||||||
end
|
end
|
||||||
|
|
||||||
def url_options
|
#def url_options
|
||||||
{:host => ""}
|
# {:host => ""}
|
||||||
end
|
#end
|
||||||
|
|
||||||
def action_hash(uid, object)
|
def action_hash(uid, object)
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
|
|
@ -109,8 +109,8 @@ class Person
|
||||||
self.id == post.person.id
|
self.id == post.person.id
|
||||||
end
|
end
|
||||||
|
|
||||||
def recieve_url
|
def receive_url
|
||||||
"#{self.url}user/#{self.owner.id}"
|
"#{self.url}receive/users/#{self.id}/"
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,12 @@ class Request
|
||||||
|
|
||||||
before_validation :clean_link
|
before_validation :clean_link
|
||||||
|
|
||||||
scope :for_user, lambda{ |user| where(:destination_url => user.url) }
|
scope :for_user, lambda{ |user| where(:destination_url => user.receive_url) }
|
||||||
scope :from_user, lambda{ |user| where(:destination_url.ne => user.url) }
|
scope :from_user, lambda{ |user| where(:destination_url.ne => user.receive_url) }
|
||||||
|
|
||||||
def self.instantiate(options = {})
|
def self.instantiate(options = {})
|
||||||
person = options[:from]
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ class User
|
||||||
self.save
|
self.save
|
||||||
|
|
||||||
if bad_friend
|
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.update_attributes(:user_refs => bad_friend.user_refs - 1)
|
||||||
bad_friend.destroy if bad_friend.user_refs == 0
|
bad_friend.destroy if bad_friend.user_refs == 0
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
|
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
|
||||||
xmlns:hm='http://host-meta.net/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'
|
<Link rel='lrdd'
|
||||||
template='<%= root_path %>webfinger?q={uri}'>
|
template='<%= root_url %>webfinger?q={uri}'>
|
||||||
<Title>Resource Descriptor</Title>
|
<Title>Resource Descriptor</Title>
|
||||||
</Link>
|
</Link>
|
||||||
</XRD>
|
</XRD>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ module Diaspora
|
||||||
end
|
end
|
||||||
|
|
||||||
def push_to_url(url)
|
def push_to_url(url)
|
||||||
hook_url = url + "receive/"
|
hook_url = url
|
||||||
xml = self.class.build_xml_for(self)
|
xml = self.class.build_xml_for(self)
|
||||||
Rails.logger.debug("Adding xml for #{self} to message queue to #{url}")
|
Rails.logger.debug("Adding xml for #{self} to message queue to #{url}")
|
||||||
@@queue.add_post_request( hook_url, xml )
|
@@queue.add_post_request( hook_url, xml )
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue