Bonfire.Federate.ActivityPub.AdapterUtils (Bonfire v1.0.0-social-rc.3.14)

View Source

Summary

Functions

Converts an interaction_policy map to a list of {circle_name, role} tuples.

without :ok / :error tuple

Functions

actor_collection(actor_id, collection)

all_activity_recipients(activity_data, object_data, fields \\ [:to, :bto, :cc, :bcc, :audience])

all_actors(activity)

all_known_recipient_characters(activity_data, object_data)

all_object_recipients(activity_or_object, fields \\ [:to, :bto, :cc, :bcc, :audience])

ap_base_url()

ap_incoming_interaction_policy_to_circle_roles(activity, interaction_policy)

Converts an interaction_policy map to a list of {circle_name, role} tuples.

Only known verbs and circles are included. Supports multiple circles per verb. Looks up followers/following URLs from the actor object if present.

Handles the special case: if automaticApproval contains only the author's identifier, this means "nobody can" and emits a negative role for all local users.

Examples

iex> interaction_policy = %{
...>   "canLike" => %{"automaticApproval" => ["https://www.w3.org/ns/activitystreams#Public"]},
...>   "canReply" => %{"automaticApproval" => "https://example.org/users/someone/followers"},
...>   "canQuote" => %{"automaticApproval" => "https://example.org/users/someone"}
...> }
iex> ap_incoming_interaction_policy_to_circle_roles(activity, interaction_policy)
[ {:guest, :react}, {:followers, :participate}, {:local, :cannot_critique} ]

ap_prepare_outgoing_interaction_policy(subject, object, opts \\ [])

apply_fun_style(fallback_module \\ __MODULE__, fun, args)

character_module(struct)

character_to_actor(character)

create_author_object(map)

create_remote_actor(actor)

fetch_pointer_for_ap_id(ap_id)

format_actor(user_etc, type \\ "Person")

get_actor_by_ap_id(ap_id, local_instance \\ nil)

get_actor_username(obj)

get_author(author)

get_by_url_ap_id_or_username(q, opts \\ [])

get_character(q, opts \\ [])

get_character_by_ap_id(ap_id)

get_character_by_ap_id!(ap_id)

without :ok / :error tuple

get_character_by_id(id, opts \\ [skip_boundary_check: true])

get_character_by_username(username)

get_context_ap_id(arg1)

get_creator_ap_id(arg1)

get_different_creator_ap_id(character)

get_in_reply_to(comment)

get_local_actor_by_ap_id(ap_id)

get_local_character_by_ap_id(ap_id, local_instance \\ nil)

get_object_ap_id(arg1)

get_object_ap_id!(object)

get_object_or_actor_by_ap_id!(ap_id)

get_or_create_service_character(service_character_id \\ service_character_id(), service_character_username \\ service_character_username())

get_or_fetch_and_create_by_uri(q, opts \\ [])

get_or_fetch_and_create_by_username(q, opts \\ [])

get_or_fetch_character_by_ap_id(actor_or_ap_id)

get_or_fetch_pointable_by_ap_id(actor_or_ap_id, opts \\ [])

get_pointable_by_peered_ap_id(ap_id)

get_pointer_id_by_ap_id(ap_id)

id_or_object_id(id)

ids_or_object_ids(list)

incoming_boundary_circles(activity, object, is_public? \\ nil)

is_follow?(arg1)

is_local?(thing, opts \\ [])

is_local_collection?(ap_id)

is_local_collection_or_built_in?(ap_id)

is_public?(object, activity)

local_actor_ids(actors)

log(l)

maybe_add_aliases(user_etc, aliases)

maybe_attach_property_value(key, url)

maybe_create_banner_object(url, actor)

maybe_create_icon_object(url, actor)

maybe_create_image_object(url, actor)

maybe_fix_image_object(url)

maybe_format_image_object_from_path(url)

maybe_pointer_for_ap_id(ap_id)

preload_peered(object)

public_uri()

public_uris()

recipients_boundary_circles(recipients, activity, is_public?, interaction_policy \\ [])

return_pointable(f, opts \\ [skip_boundary_check: true])

return_pointer(id, opts)

service_character_id()

service_character_username()

the_ap_id(ap_id)