View Source Bonfire.Tag (Bonfire v0.9.10-classic-beta.169)

An extension for Bonfire that handles tagging posts or other things:

  • @ mentions
  • #hashtags
  • others (e.g. with a Category from Bonfire.Classify or a location from Bonfire.Geolocate)

Handy commands

Copyright (c) 2020 Bonfire, Haha Academy, and CommonsPub Contributors

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Summary

Functions

For using on changesets (eg in epics)

Retrieves a list of tags by arbitrary filters. Used by

Lookup a single for a tag by its name/username

Retrieves a single tag by arbitrary filters. Used by

tag existing thing with one or multiple Tags, Needle, or anything that can be made into a tag

Add things (Pointer objects) to a tag. You usually want to add tags to a thing instead, see thing_tags_changeset

Add tags to a thing (any Pointer object which defines a many_to_many relation to tag). This function applies to your object schema but is here for convenience.

Functions

Link to this function

cast(changeset, attrs, creator, opts \\ [])

View Source

For using on changesets (eg in epics)

Callback implementation for Bonfire.Common.SchemaModule.context_module/0.

Link to this function

get_hashtags_from_changeset(changeset)

View Source
Link to this function

get_mentions_from_changeset(arg1)

View Source
Link to this function

get_or_create_hashtag(name)

View Source
Link to this function

indexing_object_format(object)

View Source
Link to this function

indexing_object_format_name(object)

View Source
Link to this function

list_trending(in_last_x_days \\ 30, limit \\ 10)

View Source
Link to this function

many(filters \\ [], opts \\ [])

View Source

Retrieves a list of tags by arbitrary filters. Used by:

  • Various parts of the codebase that need to query for tags (inc. tests)
Link to this function

maybe_find_tag(current_user, id_or_username_or_url, types \\ nil)

View Source

Try to find one (best-match) tag

Link to this function

maybe_find_tags(current_user, id_or_username_or_url, types \\ nil)

View Source

Search / autocomplete for tags by name

Link to this function

maybe_lookup_tag(id_or_username_or_url, prefix \\ "@")

View Source

Lookup a single for a tag by its name/username

Link to this function

maybe_put_tree_parent(changeset, category, creator)

View Source
Link to this function

maybe_tag(user, thing, tags \\ nil, boost_category_mentions? \\ true)

View Source

Maybe tag something

Link to this function

maybe_taxonomy_tag(user, id)

View Source
Link to this function

one(filters, opts \\ [])

View Source

Retrieves a single tag by arbitrary filters. Used by:

  • GraphQL Item queries
  • ActivityPub integration
  • Various parts of the codebase that need to query for tags (inc. tests)

Callback implementation for Bonfire.Common.SchemaModule.query_module/0.

Link to this function

search_hashtag(text, opts \\ [])

View Source
Link to this function

search_hashtag_query(text, opts)

View Source
Link to this function

tag_something(user, thing, tags, boost_or_label_category_tags? \\ true)

View Source

tag existing thing with one or multiple Tags, Needle, or anything that can be made into a tag

Link to this function

tag_things_changeset(tag, things)

View Source

Add things (Pointer objects) to a tag. You usually want to add tags to a thing instead, see thing_tags_changeset

Link to this function

thing_tags_changeset(thing, tags)

View Source

Add tags to a thing (any Pointer object which defines a many_to_many relation to tag). This function applies to your object schema but is here for convenience.