From f57d5722e6f2187bea249240eb14c881f989c3c1 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sun, 12 Jun 2022 15:36:19 -0700 Subject: first pass on federation working --- activitypub/activity.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'activitypub/activity.go') diff --git a/activitypub/activity.go b/activitypub/activity.go index 036a5ce..5d89272 100644 --- a/activitypub/activity.go +++ b/activitypub/activity.go @@ -23,7 +23,7 @@ func (activity Activity) AcceptFollow() Activity { accept.Actor = &nActor accept.Actor.Id = activity.Object.Actor var nObj ObjectBase - accept.Object = &nObj + accept.Object = nObj accept.Object.Actor = activity.Actor.Id var nNested NestedObjectBase accept.Object.Object = &nNested @@ -181,7 +181,7 @@ func (activity Activity) Reject() Activity { accept.AtContext.Context = activity.AtContext.Context accept.Type = "Reject" var nObj ObjectBase - accept.Object = &nObj + accept.Object = nObj var nActor Actor accept.Actor = &nActor accept.Actor.Id = activity.Object.Actor @@ -196,8 +196,8 @@ func (activity Activity) Reject() Activity { } func (activity Activity) Report(reason string) (bool, error) { - if isLocal, err := activity.Object.IsLocal(); !isLocal || err != nil { - return false, util.MakeError(err, "Report") + if isLocal, _ := activity.Object.IsLocal(); !isLocal { + return false, nil } reqActivity := Activity{Id: activity.Object.Id} @@ -288,7 +288,7 @@ func (activity Activity) SetActorFollowing() (Activity, error) { var query string if alreadyFollowing && alreadyFollower { - if res, err := activity.Actor.IsLocal(); err == nil && !res { + if res, _ := activity.Actor.IsLocal(); !res { go activity.Actor.DeleteCache() } else if err != nil { return activity, util.MakeError(err, "SetActorFollowing") @@ -306,10 +306,8 @@ func (activity Activity) SetActorFollowing() (Activity, error) { } if !alreadyFollowing && !alreadyFollower { - if res, err := activity.Actor.IsLocal(); err == nil && !res { + if res, _ := activity.Actor.IsLocal(); !res { go activity.Actor.WriteCache() - } else if err != nil { - return activity, util.MakeError(err, "SetActorFollowing") } query = `insert into following (id, following) values ($1, $2)` -- cgit v1.2.3