diff options
author | 2025-01-28 20:22:23 +0000 | |
---|---|---|
committer | 2025-01-28 20:22:23 +0000 | |
commit | 61141ac2324fd73221f8301ba3805c051bc99fe2 (patch) | |
tree | b05d8cd260a18d174dbad5037b9de8bde7a126a5 /internal/federation/federatingprotocol.go | |
parent | [bugfix] Allow processing null ID emojis (#3702) (diff) | |
download | gotosocial-61141ac2324fd73221f8301ba3805c051bc99fe2.tar.xz |
[chore] remove type switch in Create() and instead move to FederatedCallbacks() (#3697)
* remove type switch in Create() and instead move to FederatedCallbacks()
* add missing (my bad!) federating wrapped callbacks behaviour
* add missing license header :innocent:
* fix create flag test to use correct function
Diffstat (limited to 'internal/federation/federatingprotocol.go')
-rw-r--r-- | internal/federation/federatingprotocol.go | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/internal/federation/federatingprotocol.go b/internal/federation/federatingprotocol.go index a953701f8..2bf934161 100644 --- a/internal/federation/federatingprotocol.go +++ b/internal/federation/federatingprotocol.go @@ -456,39 +456,8 @@ func (f *Federator) FederatingCallbacks(ctx context.Context) ( other []any, err error, ) { - wrapped = pub.FederatingWrappedCallbacks{ - // OnFollow determines what action to take for this - // particular callback if a Follow Activity is handled. - // - // For our implementation, we always want to do nothing - // because we have internal logic for handling follows. - OnFollow: pub.OnFollowDoNothing, - } - - // Override some default behaviors to trigger our own side effects. - other = []any{ - func(ctx context.Context, undo vocab.ActivityStreamsUndo) error { - return f.FederatingDB().Undo(ctx, undo) - }, - func(ctx context.Context, accept vocab.ActivityStreamsAccept) error { - return f.FederatingDB().Accept(ctx, accept) - }, - func(ctx context.Context, reject vocab.ActivityStreamsReject) error { - return f.FederatingDB().Reject(ctx, reject) - }, - func(ctx context.Context, announce vocab.ActivityStreamsAnnounce) error { - return f.FederatingDB().Announce(ctx, announce) - }, - } - - // Define some of our own behaviors which are not - // overrides of the default pub.FederatingWrappedCallbacks. - other = append(other, []any{ - func(ctx context.Context, move vocab.ActivityStreamsMove) error { - return f.FederatingDB().Move(ctx, move) - }, - }...) - + wrapped = f.wrapped + other = f.callback return } |