Start work on likes/reactions
Some checks failed
/ docker (push) Failing after 1m35s

This commit is contained in:
Melody Becker 2025-06-13 16:45:28 +02:00
parent 8d2e008125
commit 4b62c32247
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
4 changed files with 77 additions and 2 deletions

View file

@ -0,0 +1,12 @@
package translators
type ActivityLikeOut struct {
Context any `json:"@context"`
Type string `json:"type"`
Id string `json:"id"`
Actor string `json:"actor"`
Object string `json:"object"`
Content *string `json:"content,omitempty"`
MkReaction *string `json:"_misskey_reaction,omitempty"`
Tags []Tag `json:"tag,omitempty"`
}

View file

@ -13,8 +13,15 @@ import (
type Tag struct {
Type string `json:"type"`
Href string `json:"href"`
Name string `json:"name"`
// ---- Section Hashtag & Mention
Href *string `json:"href,omitempty"`
// Section Emote
Id *string `json:"id,omitempty"`
Updated *time.Time `json:"updated,omitempty"`
Icon *Media `json:"icon,omitempty"`
}
type ObjectNote struct {

View file

@ -0,0 +1,53 @@
{
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"Key": "sec:Key",
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
"sensitive": "as:sensitive",
"Hashtag": "as:Hashtag",
"quoteUrl": "as:quoteUrl",
"fedibird": "http://fedibird.com/ns#",
"quoteUri": "fedibird:quoteUri",
"toot": "http://joinmastodon.org/ns#",
"Emoji": "toot:Emoji",
"featured": "toot:featured",
"discoverable": "toot:discoverable",
"indexable": "toot:indexable",
"schema": "http://schema.org#",
"PropertyValue": "schema:PropertyValue",
"value": "schema:value",
"misskey": "https://misskey-hub.net/ns#",
"_misskey_content": "misskey:_misskey_content",
"_misskey_quote": "misskey:_misskey_quote",
"_misskey_reaction": "misskey:_misskey_reaction",
"_misskey_votes": "misskey:_misskey_votes",
"_misskey_summary": "misskey:_misskey_summary",
"_misskey_followedMessage": "misskey:_misskey_followedMessage",
"_misskey_requireSigninToViewContents": "misskey:_misskey_requireSigninToViewContents",
"_misskey_makeNotesFollowersOnlyBefore": "misskey:_misskey_makeNotesFollowersOnlyBefore",
"_misskey_makeNotesHiddenBefore": "misskey:_misskey_makeNotesHiddenBefore",
"_misskey_license": "misskey:_misskey_license",
"freeText": {
"@id": "misskey:freeText",
"@type": "schema:text"
},
"isCat": "misskey:isCat",
"firefish": "https://joinfirefish.org/ns#",
"speakAsCat": "firefish:speakAsCat",
"sharkey": "https://joinsharkey.org/ns#",
"hideOnlineStatus": "sharkey:hideOnlineStatus",
"backgroundUrl": "sharkey:backgroundUrl",
"listenbrainz": "sharkey:listenbrainz",
"enableRss": "sharkey:enableRss",
"vcard": "http://www.w3.org/2006/vcard/ns#"
}
],
"type": "Like",
"id": "https://mk.absturztau.be/likes/a8ydcaw713im02nm",
"actor": "https://mk.absturztau.be/users/a1xy7910yc8401z8",
"object": "https://activitypub.academy/users/fabota_kovacul/statuses/114676133656288280",
"content": "👍",
"_misskey_reaction": "👍"
}

View file

@ -6,7 +6,9 @@ import (
"gorm.io/gorm"
)
// A Reaction is a user liking a note using an emote
// A Reaction is a user liking a note (optionally using an emote)
// A reaction may contain some content text. If yes, this is the reaction.
// It also may contain a specifically linked emote (via tag). If yes, this is the reaction and takes precedence over the content
type Reaction struct {
gorm.Model
Note Note
@ -15,4 +17,5 @@ type Reaction struct {
ReactorId string
Emote *Emote // Emote is optional. If not set, use the default emote of the server
EmoteId sql.NullInt64
Content sql.NullString // Content/text of the reaction. Used for example in cases where a unicode character is sent as emote reaction
}