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

Helpers for tagging things. Mostly wrappers around functions in Bonfire.Tag and Bonfire.Classify extensions.

This module provides functionality for processing tags, handling categories, and auto-boosting content.

Summary

Functions

Auto-boosts an object to some categories' feed.

Attempts to auto-boost an object to categories, based on which ones a user has permission to publish to.

Filters a list of categories, returning those that are auto-boostable for a user.

Casts tags if the Bonfire.Tag module is enabled for the creator.

Processes text to extract mentions, hashtags, and URLs if the Bonfire.Tag module is enabled.

Functions

Link to this function

auto_boost(categories_auto_boost, object)

View Source

Auto-boosts an object to some categories' feed.

Examples

iex> auto_boost([%Bonfire.Classify.Category{id: "123"}], %Post{id: "456"})
:ok
Link to this function

indexing_format_tags(tags)

View Source
Link to this function

maybe_auto_boost(creator, category_or_categories, object)

View Source

Attempts to auto-boost an object to categories, based on which ones a user has permission to publish to.

Examples

iex> maybe_auto_boost(%User{}, [%Bonfire.Classify.Category{id: "123"}], %Post{id: "456"})
:ok
Link to this function

maybe_boostable_categories(creator, categories)

View Source

Filters a list of categories, returning those that are auto-boostable for a user.

Examples

iex> maybe_boostable_categories(%User{}, [%Bonfire.Classify.Category{id: "123"}])
[%Bonfire.Classify.Category{id: "123", tree: nil}]
Link to this function

maybe_cast(changeset, attrs, creator, opts)

View Source

Casts tags if the Bonfire.Tag module is enabled for the creator.

Examples

iex> maybe_cast(%Ecto.Changeset{}, %{tags: ["tag1", "tag2"]}, %User{}, [])
%Ecto.Changeset{}
Link to this function

maybe_process(creator, text, opts)

View Source

Processes text to extract mentions, hashtags, and URLs if the Bonfire.Tag module is enabled.

Examples

iex> maybe_process(%User{}, "Hello @user #hashtag https://example.com", [])
{:ok, %{text: "Hello @user #hashtag https://example.com", mentions: [], hashtags: [], urls: []}}