View Source Bonfire.Social.PostContents (Bonfire v0.9.10-classic-beta.156)

Query, manipulate, and federate post contents. See also Bonfire.Social.Posts for directly handling posts.

Context for Bonfire.Data.Social.PostContent which has the following fields:

  • name (eg. title)
  • summary (eg. description)
  • html_body (NOTE: can also contain markdown or plaintext)

Summary

Functions

Returns the base query for post contents.

Given a changeset, post content attributes, creator, boundary and options, returns a changeset prepared with relevant attributes and associations.

Creates a changeset for a PostContent struct.

Given a post content ID, returns the corresponding post content.

Given post content attributes, creator, boundary, and options, prepares the post contents for processing by detecting languages, mentions, hashtags, and urls.

Given a set of filters, returns a single post content matching those filters.

Given a set of filters, returns an Ecto.Query for matching post contents.

Performs a search query on post contents based on the given text.

Functions

Link to this function

ap_receive_activity(creator, activity_data, object)

View Source
Link to this function

ap_receive_attrs_prepare(creator, activity_data, post_data, direct_recipients \\ [])

View Source

Returns the base query for post contents.

Examples

iex> Bonfire.Social.PostContents.base_query()
#Ecto.Query<from p0 in Bonfire.Data.Social.PostContent>
Link to this function

cast(changeset, attrs, creator, boundary, opts)

View Source

Given a changeset, post content attributes, creator, boundary and options, returns a changeset prepared with relevant attributes and associations.

Examples

iex> attrs = %{name: "Test Post", html_body: "Content"}
iex> creator = %Bonfire.Data.Identity.User{id: "01FXYZ123ABC"}
iex> boundary = "public"
iex> opts = []
iex> changeset = %Ecto.Changeset{}
iex> Bonfire.Social.PostContents.cast(changeset, attrs, creator, boundary, opts)
#Ecto.Changeset<...>
Link to this function

changeset(cs \\ %PostContent{}, attrs)

View Source

Creates a changeset for a PostContent struct.

Examples

iex> attrs = %{name: "Test Post", html_body: "Content"}
iex> Bonfire.Social.PostContents.changeset(%Bonfire.Data.Social.PostContent{}, attrs)
#Ecto.Changeset<...>
Link to this function

diff(previous_version, current_version)

View Source
Link to this function

edit(current_user, id, attrs)

View Source
Link to this function

editor_output_content_type(user)

View Source

Callback implementation for Bonfire.Federate.ActivityPub.FederationModules.federation_module/0.

Given a post content ID, returns the corresponding post content.

Examples

iex> Bonfire.Social.PostContents.get("01FXYZ123ABC")
%Bonfire.Data.Social.PostContent{id: "01FXYZ123ABC", ...}
Link to this function

get_versions(post_content)

View Source
Link to this function

get_versions_diffed(post_content)

View Source
Link to this function

indexing_object_format(obj)

View Source
Link to this function

maybe_detect_languages(attrs, fields \\ [:name, :summary, :html_body])

View Source
Link to this function

maybe_prepare_contents(attrs, creator, boundary, opts)

View Source

Given post content attributes, creator, boundary, and options, prepares the post contents for processing by detecting languages, mentions, hashtags, and urls.

Link to this function

merge_with_body_or_nil(attrs, map)

View Source
Link to this function

no_known_output(error, args)

View Source
Link to this function

one(filters, opts \\ [])

View Source

Given a set of filters, returns a single post content matching those filters.

Examples

iex> Bonfire.Social.PostContents.one(%{name: "Test Post"})
%Bonfire.Data.Social.PostContent{name: "Test Post", ...}
Link to this function

prepare_text(text, creator, opts)

View Source
Link to this function

query(filters, opts \\ [])

View Source

Given a set of filters, returns an Ecto.Query for matching post contents.

Examples

iex> Bonfire.Social.PostContents.query(%{name: "Test Post"})
#Ecto.Query<from p0 in Bonfire.Data.Social.PostContent, where: p0.name == ^"Test Post">
Link to this function

search_query(text, opts)

View Source

Performs a search query on post contents based on the given text.

Examples

iex> Bonfire.Social.PostContents.search_query("test", %{})
#Ecto.Query<from p0 in Bonfire.Data.Social.PostContent, ...>