From c2184d6add23d9b0ca44dbbc5d026ab4f482dceb Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 31 Jul 2021 16:35:42 -0700 Subject: added pop route for removing archived posts. removed seeing archive page when not archived posts. --- main.go | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index d43fab0..76876f2 100644 --- a/main.go +++ b/main.go @@ -855,7 +855,7 @@ func main() { go DeleteObjectRequest(db, id) } - UnArchiveLast(db) + UnArchiveLast(db, actor) if !isOP { if (!IsIDLocal(db, id)){ @@ -889,9 +889,9 @@ func main() { manage := r.URL.Query().Get("manage") col := GetCollectionFromID(id) - if len(col.OrderedItems) < 1 { - if !HasAuth(db, auth, GetActorByNameFromDB(db, board).Id) { + actor := GetActorByNameFromDB(db, board) + if !HasAuth(db, auth, actor.Id) { w.WriteHeader(http.StatusBadRequest) w.Write([]byte("")) return @@ -903,7 +903,7 @@ func main() { TombstoneObjectAndReplies(db, id) } - UnArchiveLast(db) + UnArchiveLast(db, actor.Id) if(manage == "t"){ @@ -944,7 +944,7 @@ func main() { go DeleteObjectRequest(db, id) } - UnArchiveLast(db) + UnArchiveLast(db, actor) if(manage == "t"){ http.Redirect(w, r, "/" + *Key + "/" + board , http.StatusSeeOther) @@ -1345,6 +1345,22 @@ func main() { go AddInstanceToIndexDB(db, actor) }) + http.HandleFunc("/poparchive", func(w http.ResponseWriter, r *http.Request) { + + actor := GetActorFromDB(db, Domain) + + if !HasValidation(w, r, actor) { + return + } + + id := r.URL.Query().Get("id") + board := r.URL.Query().Get("board") + + SetObjectType(db, id, "Note") + + http.Redirect(w, r, "/" + board + "/archive", http.StatusSeeOther) + }) + http.HandleFunc("/blacklist", func(w http.ResponseWriter, r *http.Request) { actor := GetActorFromDB(db, Domain) -- cgit v1.2.3