diff options
author | FChannel <> | 2022-05-07 21:21:38 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | f7bf818d29393ceaccf4d2906557351fa6a4f49f (patch) | |
tree | 723e542c8cf0db1e7e64923718977138db77b58d /db | |
parent | 3c5eebf6275e6d202f8a7b7f027aabcda5c1f332 (diff) |
added error func and general cleanup/organization
Diffstat (limited to 'db')
-rw-r--r-- | db/cache.go | 2 | ||||
-rw-r--r-- | db/database.go | 2 | ||||
-rw-r--r-- | db/follow.go | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/db/cache.go b/db/cache.go index a20a8ed..d1c1fe7 100644 --- a/db/cache.go +++ b/db/cache.go @@ -63,7 +63,7 @@ func WriteActorToCache(actorID string) error { } for _, e := range collection.OrderedItems { - if _, err := e.WriteActorObjectToCache(); err != nil { + if err := e.WriteCache(); err != nil { return err } } diff --git a/db/database.go b/db/database.go index e92eec5..5d53f46 100644 --- a/db/database.go +++ b/db/database.go @@ -658,7 +658,7 @@ func DeleteObjectRequest(id string) error { return err } - obj, err := activitypub.GetObjectFromPath(id) + obj, err := nObj.GetFromPath() if err != nil { return err } diff --git a/db/follow.go b/db/follow.go index e3c0583..3932ea1 100644 --- a/db/follow.go +++ b/db/follow.go @@ -77,7 +77,7 @@ func SetActorFollowingDB(activity activitypub.Activity) (activitypub.Activity, e if alreadyFollowing && alreadyFollower { query = `delete from following where id=$1 and following=$2` activity.Summary = activity.Object.Actor + " Unfollowing " + activity.Actor.Id - if res, err := activitypub.IsActorLocal(activity.Actor.Id); err == nil && !res { + if res, err := activity.Actor.IsLocal(); err == nil && !res { go activity.Actor.DeleteCache() } else { return activity, err @@ -95,7 +95,7 @@ func SetActorFollowingDB(activity activitypub.Activity) (activitypub.Activity, e query = `insert into following (id, following) values ($1, $2)` activity.Summary = activity.Object.Actor + " Following " + activity.Actor.Id - if res, err := activitypub.IsActorLocal(activity.Actor.Id); err == nil && !res { + if res, err := activity.Actor.IsLocal(); err == nil && !res { go WriteActorToCache(activity.Actor.Id) } if _, err := config.DB.Exec(query, activity.Object.Actor, activity.Actor.Id); err != nil { @@ -197,7 +197,7 @@ func MakeActivityRequestOutbox(activity activitypub.Activity) error { if activity.Actor.Id == config.Domain { instance = re.ReplaceAllString(config.Domain, "") } else { - _, instance = activitypub.GetActorInstance(activity.Actor.Id) + _, instance = activitypub.GetActorAndInstance(activity.Actor.Id) } date := time.Now().UTC().Format(time.RFC1123) @@ -233,7 +233,7 @@ func MakeActivityRequest(activity activitypub.Activity) error { } if actor.Id != "" { - _, instance := activitypub.GetActorInstance(actor.Id) + _, instance := activitypub.GetActorAndInstance(actor.Id) if actor.Inbox != "" { req, err := http.NewRequest("POST", actor.Inbox, bytes.NewBuffer(j)) |