linstrom/activitypub/translators/emote.go
mStar 8947d97825
Some checks failed
/ docker (push) Failing after 1m35s
Prep for reactions, some fixes and improvements
2025-06-16 08:13:11 +02:00

30 lines
668 B
Go

package translators
import (
"context"
"git.mstar.dev/mstar/linstrom/config"
"git.mstar.dev/mstar/linstrom/storage-new/dbgen"
)
func EmoteTagFromStorage(ctx context.Context, id string) (*Tag, error) {
emote, err := dbgen.Emote.Where(dbgen.Emote.ID.Eq(id)).First()
if err != nil {
return nil, err
}
emoteId := config.GlobalConfig.General.GetFullPublicUrl() + "/api/activitypub/emote/" + id
emoteMedia, err := MediaFromStorage(ctx, emote.MetadataId)
if err != nil {
return nil, err
}
out := Tag{
Type: "Emoji",
Name: emote.Name,
Href: nil,
Id: &emoteId,
Updated: &emote.UpdatedAt,
Icon: emoteMedia,
}
return &out, nil
}