Merge branch 'master' of git://github.com/tkrehbiel/diaspora
This commit is contained in:
commit
b03c90f6f2
3 changed files with 7 additions and 4 deletions
|
|
@ -47,8 +47,8 @@ class RequestsController < ApplicationController
|
||||||
begin
|
begin
|
||||||
@request = current_user.send_friend_request_to(rel_hash[:friend], aspect)
|
@request = current_user.send_friend_request_to(rel_hash[:friend], aspect)
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
raise e unless e.message.include? "already friends"
|
raise e unless e.message.include? "already"
|
||||||
flash[:notice] = "You are already friends with #{params[:request][:destination_url]}!"
|
flash[:notice] = "#{e.message} #{params[:request][:destination_url]}"
|
||||||
respond_with :location => aspect
|
respond_with :location => aspect
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,8 @@ class Person
|
||||||
|
|
||||||
return nil unless public_key_entry
|
return nil unless public_key_entry
|
||||||
|
|
||||||
public_key = public_key_entry.first.href
|
pubkey = public_key_entry.first.href
|
||||||
new_person.exported_key = Base64.decode64 public_key
|
new_person.exported_key = Base64.decode64 pubkey
|
||||||
|
|
||||||
guid = profile.links.select{|x| x.rel == 'http://joindiaspora.com/guid'}.first.href
|
guid = profile.links.select{|x| x.rel == 'http://joindiaspora.com/guid'}.first.href
|
||||||
new_person.id = guid
|
new_person.id = guid
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ module Diaspora
|
||||||
module UserModules
|
module UserModules
|
||||||
module Friending
|
module Friending
|
||||||
def send_friend_request_to(desired_friend, aspect)
|
def send_friend_request_to(desired_friend, aspect)
|
||||||
|
# should have different exception types for these?
|
||||||
|
raise "You have already sent a friend request to that person!" if self.pending_requests.detect{
|
||||||
|
|x| x.destination_url == desired_friend.receive_url }
|
||||||
raise "You are already friends with that person!" if self.friends.detect{
|
raise "You are already friends with that person!" if self.friends.detect{
|
||||||
|x| x.receive_url == desired_friend.receive_url}
|
|x| x.receive_url == desired_friend.receive_url}
|
||||||
request = Request.instantiate(
|
request = Request.instantiate(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue