summaryrefslogtreecommitdiff
path: root/internal/federation/federatingdb/undo.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-09-17 19:35:47 +0000
committerLibravatar GitHub <noreply@github.com>2024-09-17 21:35:47 +0200
commit8effc77788a201efe87636c94e16436da26b5199 (patch)
treea848340e71b2bd9a48c45c6d3376b9b0486eb98f /internal/federation/federatingdb/undo.go
parent[bugfix] Fix pending approval check (#3316) (diff)
downloadgotosocial-8effc77788a201efe87636c94e16436da26b5199.tar.xz
[chore] improved federatingdb logging in cases of unknown iri / types (#3313)
* improved federatingdb logging in cases of unknown iri / types, add new log methods * whoops; forgot to wrap log argument in serialize{} ! * use debug instead of warn level * switch last entry to Debug
Diffstat (limited to 'internal/federation/federatingdb/undo.go')
-rw-r--r--internal/federation/federatingdb/undo.go23
1 files changed, 6 insertions, 17 deletions
diff --git a/internal/federation/federatingdb/undo.go b/internal/federation/federatingdb/undo.go
index 71e248aac..b3e0a2825 100644
--- a/internal/federation/federatingdb/undo.go
+++ b/internal/federation/federatingdb/undo.go
@@ -22,7 +22,6 @@ import (
"errors"
"fmt"
- "codeberg.org/gruf/go-logger/v2/level"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/db"
@@ -33,15 +32,7 @@ import (
)
func (f *federatingDB) Undo(ctx context.Context, undo vocab.ActivityStreamsUndo) error {
- if log.Level() >= level.DEBUG {
- i, err := marshalItem(undo)
- if err != nil {
- return err
- }
- l := log.WithContext(ctx).
- WithField("undo", i)
- l.Debug("entering Undo")
- }
+ log.DebugKV(ctx, "undo", serialize{undo})
activityContext := getActivityContext(ctx)
if activityContext.internal {
@@ -59,9 +50,8 @@ func (f *federatingDB) Undo(ctx context.Context, undo vocab.ActivityStreamsUndo)
continue
}
- // Check and handle any
- // vocab.Type objects.
- switch asType.GetTypeName() {
+ // Check and handle any vocab.Type objects.
+ switch name := asType.GetTypeName(); name {
// UNDO FOLLOW
case ap.ActivityFollow:
@@ -99,10 +89,9 @@ func (f *federatingDB) Undo(ctx context.Context, undo vocab.ActivityStreamsUndo)
return err
}
- // UNDO ANNOUNCE
- case ap.ActivityAnnounce:
- // TODO: actually handle this!
- log.Warn(ctx, "skipped undo announce")
+ // UNHANDLED
+ default:
+ log.Debugf(ctx, "unhandled object type: %s", name)
}
}