create fetch entity callback
and url_to callback
This commit is contained in:
parent
35ea1d3f70
commit
7e2815fabc
2 changed files with 25 additions and 4 deletions
|
|
@ -30,6 +30,8 @@ module DiasporaFederation
|
||||||
queue_public_receive
|
queue_public_receive
|
||||||
queue_private_receive
|
queue_private_receive
|
||||||
save_entity_after_receive
|
save_entity_after_receive
|
||||||
|
fetch_public_entity
|
||||||
|
fetch_person_url_to
|
||||||
update_pod
|
update_pod
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -125,7 +127,7 @@ module DiasporaFederation
|
||||||
#
|
#
|
||||||
# fetch_author_private_key_by_entity_guid
|
# fetch_author_private_key_by_entity_guid
|
||||||
# Fetches a private key of the person who authored an entity identified by a given guid
|
# Fetches a private key of the person who authored an entity identified by a given guid
|
||||||
# @param [String] entity type (Post, Comment, Like, etc)
|
# @param [String] entity_type (Post, Comment, Like, etc)
|
||||||
# @param [String] guid of the entity
|
# @param [String] guid of the entity
|
||||||
# @return [OpenSSL::PKey::RSA] key
|
# @return [OpenSSL::PKey::RSA] key
|
||||||
#
|
#
|
||||||
|
|
@ -136,20 +138,20 @@ module DiasporaFederation
|
||||||
#
|
#
|
||||||
# fetch_author_public_key_by_entity_guid
|
# fetch_author_public_key_by_entity_guid
|
||||||
# Fetches a public key of the person who authored an entity identified by a given guid
|
# Fetches a public key of the person who authored an entity identified by a given guid
|
||||||
# @param [String] entity type (Post, Comment, Like, etc)
|
# @param [String] entity_type (Post, Comment, Like, etc)
|
||||||
# @param [String] guid of the entity
|
# @param [String] guid of the entity
|
||||||
# @return [OpenSSL::PKey::RSA] key
|
# @return [OpenSSL::PKey::RSA] key
|
||||||
#
|
#
|
||||||
# entity_author_is_local?
|
# entity_author_is_local?
|
||||||
# Reports if the author of the entity identified by a given guid is local on the pod
|
# Reports if the author of the entity identified by a given guid is local on the pod
|
||||||
# where we operate.
|
# where we operate.
|
||||||
# @param [String] entity type (Post, Comment, Like, etc)
|
# @param [String] entity_type (Post, Comment, Like, etc)
|
||||||
# @param [String] guid of the entity
|
# @param [String] guid of the entity
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
#
|
#
|
||||||
# fetch_entity_author_id_by_guid
|
# fetch_entity_author_id_by_guid
|
||||||
# Fetches Diaspora ID of the person who authored the entity identified by a given guid
|
# Fetches Diaspora ID of the person who authored the entity identified by a given guid
|
||||||
# @param [String] entity type (Post, Comment, Like, etc)
|
# @param [String] entity_type (Post, Comment, Like, etc)
|
||||||
# @param [String] guid of the entity
|
# @param [String] guid of the entity
|
||||||
# @return [String] Diaspora ID of the person
|
# @return [String] Diaspora ID of the person
|
||||||
#
|
#
|
||||||
|
|
@ -169,6 +171,16 @@ module DiasporaFederation
|
||||||
# After the xml was parsed and processed the gem calls this callback to persist the entity
|
# After the xml was parsed and processed the gem calls this callback to persist the entity
|
||||||
# @param [DiasporaFederation::Entity] entity the received entity after processing
|
# @param [DiasporaFederation::Entity] entity the received entity after processing
|
||||||
#
|
#
|
||||||
|
# fetch_public_entity
|
||||||
|
# fetch a public entity from the database
|
||||||
|
# @param [String] entity_type (Post, StatusMessage, etc)
|
||||||
|
# @param [String] guid the guid of the entity
|
||||||
|
#
|
||||||
|
# fetch_person_url_to
|
||||||
|
# fetch the url to path for a person
|
||||||
|
# @param [String] diaspora_id
|
||||||
|
# @param [String] path
|
||||||
|
#
|
||||||
# update_pod
|
# update_pod
|
||||||
# Update the pod status
|
# Update the pod status
|
||||||
# @param [String] url the pod url
|
# @param [String] url the pod url
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,15 @@ DiasporaFederation.configure do |config|
|
||||||
on :save_entity_after_receive do
|
on :save_entity_after_receive do
|
||||||
end
|
end
|
||||||
|
|
||||||
|
on :fetch_public_entity do |entity_type, guid|
|
||||||
|
type = DiasporaFederation::Entities.const_get(entity_type).entity_name
|
||||||
|
FactoryGirl.build("#{type}_entity", guid: guid)
|
||||||
|
end
|
||||||
|
|
||||||
|
on :fetch_person_url_to do |diaspora_id, path|
|
||||||
|
"http://#{diaspora_id.split('@').last}#{path}"
|
||||||
|
end
|
||||||
|
|
||||||
on :update_pod do
|
on :update_pod do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue