From 71fddc2d39ef516a74a12a95ee6dcbaf1a2f9139 Mon Sep 17 00:00:00 2001 From: kilo Date: Sun, 29 Oct 2017 05:31:37 +0100 Subject: [PATCH] Update torrents.go --- controllers/moderator/torrents.go | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/controllers/moderator/torrents.go b/controllers/moderator/torrents.go index 4b12eeef..adc66693 100644 --- a/controllers/moderator/torrents.go +++ b/controllers/moderator/torrents.go @@ -121,34 +121,21 @@ func TorrentPostEditModPanel(c *gin.Context) { // TorrentDeleteModPanel : Controller for deleting a torrent func TorrentDeleteModPanel(c *gin.Context) { id, _ := strconv.ParseInt(c.PostForm("id"), 10, 32) - definitely := c.Request.URL.Query()["definitely"] var returnRoute = "/mod/torrents" torrent, errFind := torrents.FindByID(uint(id)) if errFind == nil { var err error - if definitely != nil { - _, _, err = torrent.DefinitelyDelete() - - //delete reports of torrent - query := &search.Query{} - query.Append("torrent_id", id) - reports, _, _ := reports.FindOrderBy(query, "", 0, 0) - for _, report := range reports { - report.Delete(true) - } - returnRoute = "/mod/torrents/deleted" - } else { _, _, err = torrent.Delete(false) - //delete reports of torrent - query := &search.Query{} - query.Append("torrent_id", id) - reports, _, _ := reports.FindOrderBy(query, "", 0, 0) - for _, report := range reports { - report.Delete(false) - } + //delete reports of torrent + query := &search.Query{} + query.Append("torrent_id", id) + reports, _, _ := reports.FindOrderBy(query, "", 0, 0) + for _, report := range reports { + report.Delete() } + if err == nil { if torrent.Uploader == nil { torrent.Uploader = &models.User{}