trying deploying
This commit is contained in:
parent
65713a733e
commit
14e5b23eb5
6 changed files with 25 additions and 41 deletions
|
|
@ -24,13 +24,12 @@ class FriendRequestsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
|
||||
@friend_request = FriendRequest.new(params[:friend_request])
|
||||
@friend_request.sender = Person.new( :email => User.first.email, :url => User.first.url )
|
||||
puts
|
||||
puts
|
||||
puts params.inspect
|
||||
@friend_request.sender = current_user
|
||||
|
||||
puts
|
||||
puts
|
||||
puts @recipient
|
||||
|
||||
if @friend_request.save
|
||||
flash[:notice] = "Successfully created friend request."
|
||||
|
|
|
|||
|
|
@ -1,32 +1,18 @@
|
|||
class FriendRequest
|
||||
include MongoMapper::Document
|
||||
include ROXML
|
||||
include Diaspora::Webhooks
|
||||
|
||||
xml_name :friend_request
|
||||
xml_accessor :sender, :as => Person
|
||||
xml_accessor :recipient, :as => Person
|
||||
key :recipient_url
|
||||
|
||||
attr_accessor :sender
|
||||
|
||||
key :sender, Person
|
||||
key :recipient, Person
|
||||
validates_presence_of :recipient_url
|
||||
|
||||
validates_presence_of :sender, :recipient
|
||||
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
|
||||
push_to_recipient self.recipient
|
||||
sender = Friend.from_xml( self.sender.to_xml )
|
||||
|
||||
sender.push_to_url self.recipient_url
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
%li.message{:id => post.id}
|
||||
|
||||
= post.inspect
|
||||
%h2= post.sender.is_a? User
|
||||
|
|
|
|||
|
|
@ -2,16 +2,10 @@
|
|||
|
||||
%p
|
||||
%strong Recipient:
|
||||
= @friend_request.recipient.email
|
||||
%p
|
||||
%strong URL:
|
||||
= @friend_request.recipient.url
|
||||
= @friend_request.recipient
|
||||
%p
|
||||
%strong Sender:
|
||||
= @friend_request.sender.email
|
||||
%p
|
||||
%strong URL:
|
||||
= @friend_request.sender.url
|
||||
= @friend_request.sender
|
||||
|
||||
%p
|
||||
= link_to "Edit", edit_friend_request_path(@bookmark)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ module Diaspora
|
|||
if p.is_a? Retraction
|
||||
|
||||
p.perform
|
||||
elsif p.is_a? FriendRequest
|
||||
elsif p.is_a? Friend
|
||||
p.save
|
||||
#This line checks if the sender was in the database, among other things?
|
||||
elsif p.respond_to?(:person) && !(p.person.nil?) #WTF
|
||||
|
|
@ -65,10 +65,13 @@ module Diaspora
|
|||
@@queue.process
|
||||
end
|
||||
end
|
||||
|
||||
def push_to_recipient(recipient)
|
||||
if self.sender_id == User.first.id
|
||||
push_to( [recipient] )
|
||||
|
||||
def push_to_url(url)
|
||||
if url
|
||||
url = url + "receive/"
|
||||
xml = self.class.build_xml_for([self])
|
||||
@@queue.add_post_request( [url], xml )
|
||||
@@queue.process
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace :db do
|
|||
|
||||
# Specifiy what models to remove
|
||||
Post.delete_all
|
||||
#Person.delete_all
|
||||
Person.delete_all
|
||||
User.delete_all
|
||||
Friend.delete_all
|
||||
Profile.delete_all
|
||||
|
|
|
|||
Loading…
Reference in a new issue