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.

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.

Removes an alias relationship between a user and a target.

Functions

Link to this function

add(user, target, opts \\ [])

View Source

Adds an alias to a user, linking it to a another character.

Examples

iex> Bonfire.Social.Graph.Aliases.add(user, target)
{:ok, %Alias{}}
Link to this function

all_by_object(object, opts \\ [])

View Source

Retrieves all aliases for a given object (i.e target).

Examples

iex> Bonfire.Social.Graph.Aliases.all_by_object(object)
[%Alias{}, ...]
Link to this function

all_by_subject(user, opts \\ [])

View Source

Retrieves all aliases for a given subject.

Examples

iex> Bonfire.Social.Graph.Aliases.all_by_subject(user)
[%Alias{}, ...]
Link to this function

all_objects_by_subject(user, opts \\ [])

View Source

Retrieves all aliased objects for a given subject.

Examples

iex> Bonfire.Social.Graph.Aliases.all_objects_by_subject(user)
[%Object{}, ...]
Link to this function

all_subjects_by_object(object, opts \\ [])

View Source

Retrieves all alias subjects for a given object (i.e target).

Examples

iex> Bonfire.Social.Graph.Aliases.all_subjects_by_object(object)
[%Subject{}, ...]
Link to this function

also_known_as?(local_ap_id, target)

View Source

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
Link to this function

ap_publish_activity(subject, arg2, target)

View Source

Publishes an ActivityPub activity for a move operation.

Examples

iex> Bonfire.Social.Graph.Aliases.ap_publish_activity(subject, :move, target)
Link to this function

ap_receive_activity(subject, activity, origin_object)

View Source

Processes an incoming ActivityPub Move activity.

Examples

iex> Bonfire.Social.Graph.Aliases.ap_receive_activity(subject, activity, origin_object)
{:ok, :moved}
Link to this function

exists?(subject, target)

View Source

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.

Link to this function

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

View Source

Retrieves an alias between a subject and an object, if one exists

Examples

iex> Bonfire.Social.Graph.Aliases.get(subject, object)
{:ok, %Alias{}}
Link to this function

get!(subject, object, opts \\ [])

View Source
Link to this function

list_aliased(user, opts \\ [])

View Source

Lists entities who aliased a a given user.

Examples

iex> Bonfire.Social.Graph.Aliases.list_aliased(user)
[%AliasedEntity{}, ...]
Link to this function

list_aliases(user, opts \\ [])

View Source

Lists aliases for a given user.

Examples

iex> Bonfire.Social.Graph.Aliases.list_aliases(user)
[%Alias{}, ...]
Link to this function

list_my_aliased(current_user, opts \\ [])

View Source

Lists entities who aliased the current user.

Examples

iex> Bonfire.Social.Graph.Aliases.list_my_aliased(current_user)
[%AliasedEntity{}, ...]
Link to this function

list_my_aliases(current_user, opts \\ [])

View Source

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.