trying deploying

This commit is contained in:
ilya 2010-07-06 19:32:44 -04:00
parent 65713a733e
commit 14e5b23eb5
6 changed files with 25 additions and 41 deletions

View file

@ -24,13 +24,12 @@ class FriendRequestsController < ApplicationController
end end
def create def create
@friend_request = FriendRequest.new(params[:friend_request]) @friend_request = FriendRequest.new(params[:friend_request])
@friend_request.sender = Person.new( :email => User.first.email, :url => User.first.url ) @friend_request.sender = current_user
puts
puts
puts params.inspect
puts
puts
puts @recipient
if @friend_request.save if @friend_request.save
flash[:notice] = "Successfully created friend request." flash[:notice] = "Successfully created friend request."

View file

@ -1,32 +1,18 @@
class FriendRequest class FriendRequest
include MongoMapper::Document include MongoMapper::Document
include ROXML
include Diaspora::Webhooks
xml_name :friend_request key :recipient_url
xml_accessor :sender, :as => Person
xml_accessor :recipient, :as => Person attr_accessor :sender
key :sender, Person validates_presence_of :recipient_url
key :recipient, Person
validates_presence_of :sender, :recipient
after_create :send_off after_create :send_off
def accept
f = Friend.new
f.email = self.sender.email
f.url = self.sender.url
f.save
self.destroy
end
def reject
self.destroy
end
def send_off def send_off
push_to_recipient self.recipient sender = Friend.from_xml( self.sender.to_xml )
sender.push_to_url self.recipient_url
end end
end end

View file

@ -1,2 +1,4 @@
%li.message{:id => post.id} %li.message{:id => post.id}
= post.inspect = post.inspect
%h2= post.sender.is_a? User

View file

@ -2,16 +2,10 @@
%p %p
%strong Recipient: %strong Recipient:
= @friend_request.recipient.email = @friend_request.recipient
%p
%strong URL:
= @friend_request.recipient.url
%p %p
%strong Sender: %strong Sender:
= @friend_request.sender.email = @friend_request.sender
%p
%strong URL:
= @friend_request.sender.url
%p %p
= link_to "Edit", edit_friend_request_path(@bookmark) = link_to "Edit", edit_friend_request_path(@bookmark)

View file

@ -34,7 +34,7 @@ module Diaspora
if p.is_a? Retraction if p.is_a? Retraction
p.perform p.perform
elsif p.is_a? FriendRequest elsif p.is_a? Friend
p.save p.save
#This line checks if the sender was in the database, among other things? #This line checks if the sender was in the database, among other things?
elsif p.respond_to?(:person) && !(p.person.nil?) #WTF elsif p.respond_to?(:person) && !(p.person.nil?) #WTF
@ -65,10 +65,13 @@ module Diaspora
@@queue.process @@queue.process
end end
end end
def push_to_recipient(recipient) def push_to_url(url)
if self.sender_id == User.first.id if url
push_to( [recipient] ) url = url + "receive/"
xml = self.class.build_xml_for([self])
@@queue.add_post_request( [url], xml )
@@queue.process
end end
end end

View file

@ -20,7 +20,7 @@ namespace :db do
# Specifiy what models to remove # Specifiy what models to remove
Post.delete_all Post.delete_all
#Person.delete_all Person.delete_all
User.delete_all User.delete_all
Friend.delete_all Friend.delete_all
Profile.delete_all Profile.delete_all