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 and License
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)
Callback implementation for Bonfire.Common.SchemaModule.context_module/0
.
Retrieves a list of tags by arbitrary filters. Used by
Try to find one (best-match) tag
Search / autocomplete for tags by name
Lookup a single for a tag by its name/username
Maybe tag something
Retrieves a single tag by arbitrary filters. Used by
Callback implementation for Bonfire.Common.SchemaModule.query_module/0
.
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
For using on changesets (eg in epics)
Callback implementation for Bonfire.Common.SchemaModule.context_module/0
.
Retrieves a list of tags by arbitrary filters. Used by:
- Various parts of the codebase that need to query for tags (inc. tests)
Try to find one (best-match) tag
maybe_find_tags(current_user, id_or_username_or_url, types \\ nil)
View SourceSearch / autocomplete for tags by name
Lookup a single for a tag by its name/username
maybe_tag(user, thing, tags \\ nil, boost_category_mentions? \\ true)
View SourceMaybe tag something
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
.
tag_something(user, thing, tags, boost_or_label_category_tags? \\ true)
View Sourcetag 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.