diff options
author | FChannel <> | 2021-06-03 01:19:37 -0700 |
---|---|---|
committer | FChannel <> | 2021-06-03 01:19:37 -0700 |
commit | 9d937e6f895ca7213ae759efca9b292a1d014ab3 (patch) | |
tree | eecfbe1c593afc5c1c2e4017a109cfb94a51a014 /main.go | |
parent | 60b6bdf1c021fcffff397c7b1439a1407ed90f0a (diff) |
cleaning up removing posts
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 77 |
1 files changed, 31 insertions, 46 deletions
@@ -739,40 +739,29 @@ func main() { OP = col.OrderedItems[0].InReplyTo[0].Id } - if !IsIDLocal(db, id) { - CloseLocalReportDB(db, id, board) - CreateLocalDeleteDB(db, id, "post") - if(manage == "t") { - http.Redirect(w, r, "/" + *Key + "/" + board, http.StatusSeeOther) - } else if(OP != ""){ - http.Redirect(w, r, "/" + board + "/" + remoteShort(OP), http.StatusSeeOther) - } else { - http.Redirect(w, r, "/" + board, http.StatusSeeOther) - } - - return + if !isOP { + SetObject(db, id, "Removed") + } else { + SetObjectAndReplies(db, id, "Removed") } - if !isOP { - DeleteReportActivity(db, id) - DeleteObjectRequest(db, id) - DeleteObject(db, obj.Id) - if(manage == "t"){ - http.Redirect(w, r, "/" + *Key + "/" + board , http.StatusSeeOther) - }else{ + if IsIDLocal(db, id){ + DeleteObjectRequest(db, id) + } + + if(manage == "t"){ + http.Redirect(w, r, "/" + *Key + "/" + board , http.StatusSeeOther) + return + } else if !isOP { + if (!IsIDLocal(db, id)){ + http.Redirect(w, r, "/" + board + "/" + remoteShort(OP), http.StatusSeeOther) + return + } else { http.Redirect(w, r, OP, http.StatusSeeOther) + return } - return - } else { - DeleteReportActivity(db, id) - DeleteObjectAndRepliesRequest(db, id) - DeleteObjectAndReplies(db, obj.Id) - if(manage == "t"){ - http.Redirect(w, r, "/" + *Key + "/" + board , http.StatusSeeOther) - }else{ - http.Redirect(w, r, "/" + board, http.StatusSeeOther) - } + http.Redirect(w, r, "/" + board, http.StatusSeeOther) return } @@ -809,26 +798,22 @@ func main() { return } - - - if !IsIDLocal(db, id) { - CreateLocalDeleteDB(db, id, "attachment") - if(manage == "t") { - http.Redirect(w, r, "/" + *Key + "/" + board, http.StatusSeeOther) - } else { - http.Redirect(w, r, "/" + board + "/" + remoteShort(OP), http.StatusSeeOther) - } - return - } - - DeleteAttachmentFromFile(db, id) - DeletePreviewFromFile(db, id) - - if(manage == "t") { + SetAttachmentFromDB(db, id, "Removed") + SetPreviewFromDB(db, id, "Removed") + + if (manage == "t") { http.Redirect(w, r, "/" + *Key + "/" + board, http.StatusSeeOther) - } else { + return + } else if !IsIDLocal(db, OP) { + http.Redirect(w, r, "/" + board + "/" + remoteShort(OP), http.StatusSeeOther) + return + } else { http.Redirect(w, r, OP, http.StatusSeeOther) + return } + + w.WriteHeader(http.StatusBadRequest) + w.Write([]byte("")) }) http.HandleFunc("/report", func(w http.ResponseWriter, r *http.Request){ |