Work on failed outbound requests and move type migrators

- DB type migrators are now in separate file, in preparation for full
  custom sql migration statements
- Start work on handling failed outbound requests stored in the db
This commit is contained in:
Melody Becker 2025-07-03 13:57:30 +02:00
parent 81a01fbf8b
commit 7ac4c628b8
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
13 changed files with 372 additions and 145 deletions

View file

@ -6,6 +6,7 @@ import (
"errors"
"io"
"net/http"
"slices"
webutils "git.mstar.dev/mstar/goutils/http"
"git.mstar.dev/mstar/goutils/sliceutils"
@ -23,10 +24,11 @@ import (
func postAs(w http.ResponseWriter, r *http.Request) {
type Inbound struct {
Username string `json:"username"`
Content string `json:"content"`
ContentWarning *string `json:"content_warning"`
ReplyTo *string `json:"reply_to"`
Username string `json:"username"`
Content string `json:"content"`
ContentWarning *string `json:"content_warning"`
ReplyTo *string `json:"reply_to"`
Mentions []string `json:"mentions"`
}
log := hlog.FromRequest(r)
dec := json.NewDecoder(r.Body)
@ -86,7 +88,9 @@ func postAs(w http.ResponseWriter, r *http.Request) {
return
}
}
mentions := webshared.MentionsFromContent(data.Content)
mentions := sliceutils.RemoveDuplicate(
slices.Concat(webshared.MentionsFromContent(data.Content), data.Mentions),
)
dbPings := []*models.NoteToPing{}
for _, mention := range mentions {
accId, err := activitypub.ImportRemoteAccountByHandle(mention)