Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Update torrents.go

Cette révision appartient à :
kilo 2017-10-29 05:31:37 +01:00 révisé par GitHub
Parent a6ca5e5b88
révision 71fddc2d39
Aucune clé n'a été trouvée pour cette signature dans la base de données
ID de la clé GPG: 4AEE18F83AFDEB23

Voir le fichier

@ -121,24 +121,11 @@ func TorrentPostEditModPanel(c *gin.Context) {
// TorrentDeleteModPanel : Controller for deleting a torrent // TorrentDeleteModPanel : Controller for deleting a torrent
func TorrentDeleteModPanel(c *gin.Context) { func TorrentDeleteModPanel(c *gin.Context) {
id, _ := strconv.ParseInt(c.PostForm("id"), 10, 32) id, _ := strconv.ParseInt(c.PostForm("id"), 10, 32)
definitely := c.Request.URL.Query()["definitely"]
var returnRoute = "/mod/torrents" var returnRoute = "/mod/torrents"
torrent, errFind := torrents.FindByID(uint(id)) torrent, errFind := torrents.FindByID(uint(id))
if errFind == nil { if errFind == nil {
var err error 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) _, _, err = torrent.Delete(false)
//delete reports of torrent //delete reports of torrent
@ -146,9 +133,9 @@ func TorrentDeleteModPanel(c *gin.Context) {
query.Append("torrent_id", id) query.Append("torrent_id", id)
reports, _, _ := reports.FindOrderBy(query, "", 0, 0) reports, _, _ := reports.FindOrderBy(query, "", 0, 0)
for _, report := range reports { for _, report := range reports {
report.Delete(false) report.Delete()
}
} }
if err == nil { if err == nil {
if torrent.Uploader == nil { if torrent.Uploader == nil {
torrent.Uploader = &models.User{} torrent.Uploader = &models.User{}