summaryrefslogtreecommitdiff
path: root/internal/db/tag.go
diff options
context:
space:
mode:
authorLibravatar Vyr Cossont <VyrCossont@users.noreply.github.com>2024-07-29 11:26:31 -0700
committerLibravatar GitHub <noreply@github.com>2024-07-29 19:26:31 +0100
commita237e2b295fee71bdf7266520b0b6e0fb79b565c (patch)
treec522adc47019584b60de9420595505820635bb11 /internal/db/tag.go
parent[bugfix] take into account rotation when generating thumbnail (#3147) (diff)
downloadgotosocial-a237e2b295fee71bdf7266520b0b6e0fb79b565c.tar.xz
[feature] Implement following hashtags (#3141)
* Implement followed tags API * Insert statuses with followed tags into home timelines * Test following and unfollowing tags * Correct Swagger path params * Trim conversation caches * Migration for followed_tags table * Followed tag caches and DB implementation * Lint and tests * Add missing tag info endpoint, reorganize tag API * Unwrap boosts when timelining based on tags * Apply visibility filters to tag followers * Address review comments
Diffstat (limited to 'internal/db/tag.go')
-rw-r--r--internal/db/tag.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/db/tag.go b/internal/db/tag.go
index c0642f5a4..66c880e86 100644
--- a/internal/db/tag.go
+++ b/internal/db/tag.go
@@ -21,6 +21,7 @@ import (
"context"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
+ "github.com/superseriousbusiness/gotosocial/internal/paging"
)
// Tag contains functions for getting/creating tags in the database.
@@ -36,4 +37,24 @@ type Tag interface {
// GetTags gets multiple tags.
GetTags(ctx context.Context, ids []string) ([]*gtsmodel.Tag, error)
+
+ // GetFollowedTags gets the user's followed tags.
+ GetFollowedTags(ctx context.Context, accountID string, page *paging.Page) ([]*gtsmodel.Tag, error)
+
+ // IsAccountFollowingTag returns whether the account follows the given tag.
+ IsAccountFollowingTag(ctx context.Context, accountID string, tagID string) (bool, error)
+
+ // PutFollowedTag creates a new followed tag for a the given user.
+ // If it already exists, it returns without an error.
+ PutFollowedTag(ctx context.Context, accountID string, tagID string) error
+
+ // DeleteFollowedTag deletes a followed tag for a the given user.
+ // If no such followed tag exists, it returns without an error.
+ DeleteFollowedTag(ctx context.Context, accountID string, tagID string) error
+
+ // DeleteFollowedTagsByAccountID deletes all of an account's followed tags.
+ DeleteFollowedTagsByAccountID(ctx context.Context, accountID string) error
+
+ // GetAccountIDsFollowingTagIDs returns the account IDs of any followers of the given tag IDs.
+ GetAccountIDsFollowingTagIDs(ctx context.Context, tagIDs []string) ([]string, error)
}