rename callbacks
This commit is contained in:
parent
846483290f
commit
f4066f6105
7 changed files with 12 additions and 12 deletions
|
|
@ -43,7 +43,7 @@ DiasporaFederation.configure do |config|
|
|||
config.server_uri = AppConfig.pod_uri
|
||||
|
||||
config.define_callbacks do
|
||||
on :person_webfinger_fetch do |diaspora_id|
|
||||
on :fetch_person_for_webfinger do |diaspora_id|
|
||||
person = Person.find_local_by_diaspora_id(diaspora_id)
|
||||
if person
|
||||
DiasporaFederation::Discovery::WebFinger.new(
|
||||
|
|
@ -52,7 +52,7 @@ DiasporaFederation.configure do |config|
|
|||
end
|
||||
end
|
||||
|
||||
on :person_hcard_fetch do |guid|
|
||||
on :fetch_person_for_hcard do |guid|
|
||||
# ...
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module DiasporaFederation
|
|||
#
|
||||
# GET /hcard/users/:guid
|
||||
def hcard
|
||||
person_hcard = DiasporaFederation.callbacks.trigger(:person_hcard_fetch, params[:guid])
|
||||
person_hcard = DiasporaFederation.callbacks.trigger(:fetch_person_for_hcard, params[:guid])
|
||||
|
||||
if person_hcard.nil?
|
||||
render nothing: true, status: 404
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ module DiasporaFederation
|
|||
end
|
||||
|
||||
def find_person_webfinger(query)
|
||||
DiasporaFederation.callbacks.trigger(:person_webfinger_fetch, query.strip.downcase.sub("acct:", ""))
|
||||
DiasporaFederation.callbacks.trigger(:fetch_person_for_webfinger, query.strip.downcase.sub("acct:", ""))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ module DiasporaFederation
|
|||
extend Logging
|
||||
|
||||
@callbacks = Callbacks.new %i(
|
||||
person_webfinger_fetch
|
||||
person_hcard_fetch
|
||||
fetch_person_for_webfinger
|
||||
fetch_person_for_hcard
|
||||
)
|
||||
|
||||
class << self
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ module DiasporaFederation
|
|||
expect(response).to be_not_found
|
||||
end
|
||||
|
||||
it "calls the person_hcard_fetch callback" do
|
||||
it "calls the fetch_person_for_hcard callback" do
|
||||
expect(DiasporaFederation.callbacks).to receive(:trigger)
|
||||
.with(:person_hcard_fetch, alice.guid)
|
||||
.with(:fetch_person_for_hcard, alice.guid)
|
||||
.and_call_original
|
||||
get :hcard, "guid" => alice.guid
|
||||
end
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ module DiasporaFederation
|
|||
expect(response).to be_not_found
|
||||
end
|
||||
|
||||
it "calls the person_webfinger_fetch callback" do
|
||||
it "calls the fetch_person_for_webfinger callback" do
|
||||
expect(DiasporaFederation.callbacks).to receive(:trigger)
|
||||
.with(:person_webfinger_fetch, "alice@localhost:3000")
|
||||
.with(:fetch_person_for_webfinger, "alice@localhost:3000")
|
||||
.and_call_original
|
||||
get :legacy_webfinger, "q" => "acct:alice@localhost:3000"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ DiasporaFederation.configure do |config|
|
|||
config.certificate_authorities = ca_file
|
||||
|
||||
config.define_callbacks do
|
||||
on :person_webfinger_fetch do |diaspora_id|
|
||||
on :fetch_person_for_webfinger do |diaspora_id|
|
||||
person = Person.find_by(diaspora_id: diaspora_id)
|
||||
if person
|
||||
DiasporaFederation::Discovery::WebFinger.new(
|
||||
|
|
@ -33,7 +33,7 @@ DiasporaFederation.configure do |config|
|
|||
end
|
||||
end
|
||||
|
||||
on :person_hcard_fetch do |guid|
|
||||
on :fetch_person_for_hcard do |guid|
|
||||
person = Person.find_by(guid: guid)
|
||||
if person
|
||||
DiasporaFederation::Discovery::HCard.new(
|
||||
|
|
|
|||
Loading…
Reference in a new issue