Skip to content
Extraits de code Groupes Projets
Valider 35676cdd rédigé par Maxwell Salzberg's avatar Maxwell Salzberg
Parcourir les fichiers

fix #2627 (webfinger produces 500 error, and refactor a little to encapsulate...

fix #2627 (webfinger produces 500 error, and refactor a little to encapsulate into Webfinger object a bit more
parent 1251f743
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -42,7 +42,7 @@ class PeopleController < ApplicationController
#only do it if it is an email address
if diaspora_id?(params[:q])
people = Person.where(:diaspora_handle => params[:q].downcase)
webfinger(params[:q]) if people.empty?
Webfinger.in_background(params[:q]) if people.empty?
else
people = Person.search(params[:q], current_user)
end
......@@ -53,7 +53,7 @@ class PeopleController < ApplicationController
#only do it if it is an email address
if diaspora_id?(params[:q])
people = Person.where(:diaspora_handle => params[:q])
webfinger(params[:q]) if people.empty?
Webfinger.in_background(params[:q]) if people.empty?
else
people = Person.search(params[:q], current_user)
end
......@@ -131,7 +131,7 @@ class PeopleController < ApplicationController
def retrieve_remote
if params[:diaspora_handle]
webfinger(params[:diaspora_handle], :single_aspect_form => true)
Webfinger.in_background(params[:diaspora_handle], :single_aspect_form => true)
render :nothing => true
else
render :nothing => true, :status => 422
......@@ -161,7 +161,6 @@ class PeopleController < ApplicationController
@contact = current_user.contact_for(@person) || Contact.new
render :partial => 'aspect_membership_dropdown', :locals => {:contact => @contact, :person => @person, :hang => 'left'}
end
Webfinger.new(account, opts)
end
def diaspora_id?(query)
......@@ -169,9 +168,6 @@ class PeopleController < ApplicationController
end
private
def webfinger(account, opts = {})
Webfinger.new(account, opts)
end
def remote_profile_with_no_user_session?
@person && @person.remote? && !user_signed_in?
......
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'lib/webfinger'
module Jobs
class FetchWebfinger < Base
@queue = :socket_webfinger
def self.perform(account)
Webfinger.new(account).fetch
end
end
end
......@@ -9,6 +9,10 @@ class Webfinger
Rails.logger.info("event=webfinger status=initialized target=#{account}")
end
def self.in_background(account, opts={})
Resque.enqueue(Jobs::FetchWebfinger, account)
end
def fetch
begin
person = Person.by_account_identifier(@account)
......
......@@ -385,11 +385,4 @@ describe PeopleController do
@controller.diaspora_id?("ilya_2%3@joindiaspora.com").should be_false
end
end
describe '#webfinger' do
it 'calls Webfinger.new' do
Webfinger.should_receive(:new).with(@user.diaspora_handle, anything).once
get :retrieve_remote, :diaspora_handle => @user.diaspora_handle
end
end
end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter