View Source Bonfire.Social.Graph.Aliases (Bonfire v0.9.10-classic-beta.169)
Implements aliases (i.e. "also known as") for characters in Bonfire.
This module provides functionality for managing aliases, including adding, removing, and querying aliases. It also implements ActivityPub federation for the "Move" activity.
Summary
Functions
Adds an alias to a user, linking it to a another character.
Retrieves all aliases for a given object (i.e target).
Retrieves all aliases for a given subject.
Retrieves all aliased objects for a given subject.
Retrieves all alias subjects for a given object (i.e target).
Checks if a local user is also known as the target.
Publishes an ActivityPub activity for a move operation.
Processes an incoming ActivityPub Move activity.
Checks if an alias relationship exists between a subject and a target.
Callback implementation for Bonfire.Federate.ActivityPub.FederationModules.federation_module/0
.
Retrieves an alias between a subject and an object, if one exists
Lists entities who aliased a a given user.
Lists aliases for a given user.
Lists entities who aliased the current user.
Lists aliases for the current user.
Initiates a move operation for migrating a local user to another instance.
Callback implementation for Bonfire.Common.ContextModule.query_module/0
.
Removes an alias relationship between a user and a target.
Callback implementation for Bonfire.Common.ContextModule.schema_module/0
.
Functions
Adds an alias to a user, linking it to a another character.
Examples
iex> Bonfire.Social.Graph.Aliases.add(user, target)
{:ok, %Alias{}}
Retrieves all aliases for a given object (i.e target).
Examples
iex> Bonfire.Social.Graph.Aliases.all_by_object(object)
[%Alias{}, ...]
Retrieves all aliases for a given subject.
Examples
iex> Bonfire.Social.Graph.Aliases.all_by_subject(user)
[%Alias{}, ...]
Retrieves all aliased objects for a given subject.
Examples
iex> Bonfire.Social.Graph.Aliases.all_objects_by_subject(user)
[%Object{}, ...]
Retrieves all alias subjects for a given object (i.e target).
Examples
iex> Bonfire.Social.Graph.Aliases.all_subjects_by_object(object)
[%Subject{}, ...]
Checks if a local user is also known as the target.
Examples
iex> Bonfire.Social.Graph.Aliases.also_known_as?("http://example.com/user", target)
true
iex> Bonfire.Social.Graph.Aliases.also_known_as?(%User{}, target)
true
Publishes an ActivityPub activity for a move operation.
Examples
iex> Bonfire.Social.Graph.Aliases.ap_publish_activity(subject, :move, target)
Processes an incoming ActivityPub Move activity.
Examples
iex> Bonfire.Social.Graph.Aliases.ap_receive_activity(subject, activity, origin_object)
{:ok, :moved}
Checks if an alias relationship exists between a subject and a target.
Examples
iex> Bonfire.Social.Graph.Aliases.exists?(subject, target)
true
Callback implementation for Bonfire.Federate.ActivityPub.FederationModules.federation_module/0
.
Retrieves an alias between a subject and an object, if one exists
Examples
iex> Bonfire.Social.Graph.Aliases.get(subject, object)
{:ok, %Alias{}}
Lists entities who aliased a a given user.
Examples
iex> Bonfire.Social.Graph.Aliases.list_aliased(user)
[%AliasedEntity{}, ...]
Lists aliases for a given user.
Examples
iex> Bonfire.Social.Graph.Aliases.list_aliases(user)
[%Alias{}, ...]
Lists entities who aliased the current user.
Examples
iex> Bonfire.Social.Graph.Aliases.list_my_aliased(current_user)
[%AliasedEntity{}, ...]
Lists aliases for the current user.
Examples
iex> Bonfire.Social.Graph.Aliases.list_my_aliases(current_user)
[%Alias{}, ...]
Initiates a move operation for migrating a local user to another instance.
Examples
iex> Bonfire.Social.Graph.Aliases.move(subject, target)
{:ok, :moved}
Callback implementation for Bonfire.Common.ContextModule.query_module/0
.
Removes an alias relationship between a user and a target.
Examples
iex> Bonfire.Social.Graph.Aliases.remove(user, target)
Callback implementation for Bonfire.Common.ContextModule.schema_module/0
.