From 26db3d04944e838e6de5aeb736c59982ed226c48 Mon Sep 17 00:00:00 2001 From: FChannel <=> Date: Thu, 28 Jan 2021 19:59:37 -0800 Subject: delete objects local and remote --- main.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 8afd834..67ce815 100644 --- a/main.go +++ b/main.go @@ -700,9 +700,9 @@ func main() { obj.Id = id obj.Actor = &actor - count, _ := GetObjectRepliesDBCount(db, obj) + isOP := CheckIfObjectOP(db, obj.Id) - if count == 0 { + if !isOP { DeleteObject(db, obj.Id) http.Redirect(w, r, r.Header.Get("Referer"), http.StatusSeeOther) return @@ -1771,14 +1771,22 @@ func DeleteObjectAndRepliesRequest(db *sql.DB, id string) { activity := CreateActivity("Delete", nObj) - obj := GetObjectFromPath(db, id) + obj := GetObjectByIDFromDB(db, id) + + activity.Actor.Id = obj.OrderedItems[0].Actor.Id - nObj.Actor = obj.Actor - followers := GetActorFollowDB(db, obj.Actor.Id) + activity.Object = &obj.OrderedItems[0] + + followers := GetActorFollowDB(db, obj.OrderedItems[0].Actor.Id) for _, e := range followers { activity.To = append(activity.To, e.Id) } + following := GetActorFollowingDB(db, obj.OrderedItems[0].Actor.Id) + for _, e := range following { + activity.To = append(activity.To, e.Id) + } + MakeActivityRequest(db, activity) } -- cgit v1.2.3