Handle create requests but immediately throw an error that we ignore them

This commit is contained in:
Gabe Kangas 2022-01-12 18:42:33 -08:00
parent e8436f063e
commit 9eecf1c902
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA
2 changed files with 16 additions and 5 deletions

View File

@ -0,0 +1,13 @@
package inbox
import (
"context"
"github.com/go-fed/activity/streams/vocab"
"github.com/pkg/errors"
)
func handleCreateRequest(c context.Context, activity vocab.ActivityStreamsCreate) error {
iri := activity.GetJSONLDId().GetIRI().String()
return errors.New("not handling create request of: " + iri)
}

View File

@ -24,14 +24,12 @@ func handle(request apmodels.InboxRequest) {
log.Debugln("Error in attempting to verify request", err)
return
} else if !verified {
log.Errorln("Request failed verification", err)
log.Debugln("Request failed verification", err)
return
}
// c := context.WithValue(context.Background(), "account", request.ForLocalAccount) //nolint
if err := resolvers.Resolve(context.Background(), request.Body, handleUpdateRequest, handleFollowInboxRequest, handleLikeRequest, handleAnnounceRequest, handleUndoInboxRequest); err != nil {
log.Errorln("resolver error:", err)
if err := resolvers.Resolve(context.Background(), request.Body, handleUpdateRequest, handleFollowInboxRequest, handleLikeRequest, handleAnnounceRequest, handleUndoInboxRequest, handleCreateRequest); err != nil {
log.Debugln("resolver error:", err)
}
}