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:
parent
81a01fbf8b
commit
7ac4c628b8
13 changed files with 372 additions and 145 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue