Prep for reactions, some fixes and improvements
Some checks failed
/ docker (push) Failing after 1m35s
Some checks failed
/ docker (push) Failing after 1m35s
This commit is contained in:
parent
4b62c32247
commit
8947d97825
13 changed files with 262 additions and 43 deletions
30
activitypub/translators/emote.go
Normal file
30
activitypub/translators/emote.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue