aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2022-06-12 16:20:59 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commit0418dab57f9cf19540234d157a512e30a70a7152 (patch)
treee01656aa763eb33ca1114de95d9fde61db175af1
parentf57d5722e6f2187bea249240eb14c881f989c3c1 (diff)
error with getting object sets actor to empty
-rw-r--r--activitypub/object.go8
-rw-r--r--route/routes/actor.go3
2 files changed, 4 insertions, 7 deletions
diff --git a/activitypub/object.go b/activitypub/object.go
index e26514d..74fc136 100644
--- a/activitypub/object.go
+++ b/activitypub/object.go
@@ -290,6 +290,7 @@ func (obj ObjectBase) DeleteRequest() error {
if err != nil {
return util.MakeError(err, "DeleteRequest")
}
+
for _, e := range following {
activity.To = append(activity.To, e.Id)
}
@@ -427,7 +428,7 @@ func (obj ObjectBase) GetCollectionFromPath() (Collection, error) {
query := `select x.id, x.name, x.content, x.type, x.published, x.updated, x.attributedto, x.attachment, x.preview, x.actor, x.tripcode, x.sensitive from (select id, name, content, type, published, updated, attributedto, attachment, preview, actor, tripcode, sensitive from activitystream where id like $1 and (type='Note' or type='Archive') union select id, name, content, type, published, updated, attributedto, attachment, preview, actor, tripcode, sensitive from cacheactivitystream where id like $1 and (type='Note' or type='Archive')) as x order by x.updated`
if err = config.DB.QueryRow(query, obj.Id).Scan(&post.Id, &post.Name, &post.Content, &post.Type, &post.Published, &post.Updated, &post.AttributedTo, &post.Attachment[0].Id, &post.Preview.Id, &actor.Id, &post.TripCode, &post.Sensitive); err != nil {
- return nColl, util.MakeError(err, "GetCollectionFromPath")
+ return nColl, nil
}
post.Actor = actor.Id
@@ -475,9 +476,6 @@ func (obj ObjectBase) GetFromPath() (ObjectBase, error) {
return post, util.MakeError(err, "GetFromPath")
}
- var nActor Actor
- post.Actor = nActor.Id
-
var postCnt int
var imgCnt int
@@ -977,13 +975,11 @@ func (obj ObjectBase) _Tombstone() error {
datetime := time.Now().UTC().Format(time.RFC3339)
query := `update activitystream set type='Tombstone', name='', content='', attributedto='deleted', tripcode='', deleted=$1 where id=$2`
-
if _, err := config.DB.Exec(query, datetime, obj.Id); err != nil {
return util.MakeError(err, "_Tombstone")
}
query = `update cacheactivitystream set type='Tombstone', name='', content='', attributedto='deleted', tripcode='', deleted=$1 where id=$2`
-
_, err := config.DB.Exec(query, datetime, obj.Id)
return util.MakeError(err, "_Tombstone")
}
diff --git a/route/routes/actor.go b/route/routes/actor.go
index 94623f0..1072472 100644
--- a/route/routes/actor.go
+++ b/route/routes/actor.go
@@ -81,7 +81,7 @@ func ActorInbox(ctx *fiber.Ctx) error {
for _, e := range activity.To {
actor, err := activitypub.GetActorFromDB(e)
if err != nil {
- return util.MakeError(err, "")
+ return util.MakeError(err, "ActorInbox")
}
if actor.Id != "" && actor.Id != config.Domain {
@@ -96,6 +96,7 @@ func ActorInbox(ctx *fiber.Ctx) error {
if err := activity.Object.Tombstone(); err != nil {
return util.MakeError(err, "ActorInbox")
}
+
if err := actor.UnArchiveLast(); err != nil {
return util.MakeError(err, "ActorInbox")
}