View Source Bonfire.Social.Tags (Bonfire v0.9.10-classic-beta.169)
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
Auto-boosts an object to some categories' feed.
Examples
iex> auto_boost([%Bonfire.Classify.Category{id: "123"}], %Post{id: "456"})
:ok
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
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}]
Casts tags if the Bonfire.Tag module is enabled for the creator.
Examples
iex> maybe_cast(%Ecto.Changeset{}, %{tags: ["tag1", "tag2"]}, %User{}, [])
%Ecto.Changeset{}
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: []}}