View Source Bonfire.Social.Tags (Bonfire v0.9.11-social-beta.6)

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_boost(categories_auto_boost, object)

Auto-boosts an object to some categories' feed.

Examples

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

indexing_format_tags(tags)

maybe_auto_boost(creator, category_or_categories, object)

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

maybe_boostable_categories(creator, categories)

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}]

maybe_cast(changeset, attrs, creator, opts)

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

Examples

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

maybe_process(creator, text, opts)

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: []}}