diff options
author | 2024-07-29 11:26:31 -0700 | |
---|---|---|
committer | 2024-07-29 19:26:31 +0100 | |
commit | a237e2b295fee71bdf7266520b0b6e0fb79b565c (patch) | |
tree | c522adc47019584b60de9420595505820635bb11 /internal/typeutils | |
parent | [bugfix] take into account rotation when generating thumbnail (#3147) (diff) | |
download | gotosocial-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/typeutils')
-rw-r--r-- | internal/typeutils/internaltofrontend.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index cbe746d2f..c555e1d04 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -740,7 +740,8 @@ func (c *Converter) EmojiCategoryToAPIEmojiCategory(ctx context.Context, categor // TagToAPITag converts a gts model tag into its api (frontend) representation for serialization on the API. // If stubHistory is set to 'true', then the 'history' field of the tag will be populated with a pointer to an empty slice, for API compatibility reasons. -func (c *Converter) TagToAPITag(ctx context.Context, t *gtsmodel.Tag, stubHistory bool) (apimodel.Tag, error) { +// following is an optional flag marking whether the currently authenticated user (if there is one) is following the tag. +func (c *Converter) TagToAPITag(ctx context.Context, t *gtsmodel.Tag, stubHistory bool, following *bool) (apimodel.Tag, error) { return apimodel.Tag{ Name: strings.ToLower(t.Name), URL: uris.URIForTag(t.Name), @@ -752,6 +753,7 @@ func (c *Converter) TagToAPITag(ctx context.Context, t *gtsmodel.Tag, stubHistor h := make([]any, 0) return &h }(), + Following: following, }, nil } @@ -2347,7 +2349,7 @@ func (c *Converter) convertTagsToAPITags(ctx context.Context, tags []*gtsmodel.T // Convert GTS models to frontend models for _, tag := range tags { - apiTag, err := c.TagToAPITag(ctx, tag, false) + apiTag, err := c.TagToAPITag(ctx, tag, false, nil) if err != nil { errs.Appendf("error converting tag %s to api tag: %w", tag.ID, err) continue |