Update torrents.go
Cette révision appartient à :
Parent
a6ca5e5b88
révision
71fddc2d39
1 fichiers modifiés avec 7 ajouts et 20 suppressions
|
@ -121,24 +121,11 @@ 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
|
||||
|
@ -146,9 +133,9 @@ func TorrentDeleteModPanel(c *gin.Context) {
|
|||
query.Append("torrent_id", id)
|
||||
reports, _, _ := reports.FindOrderBy(query, "", 0, 0)
|
||||
for _, report := range reports {
|
||||
report.Delete(false)
|
||||
}
|
||||
report.Delete()
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
if torrent.Uploader == nil {
|
||||
torrent.Uploader = &models.User{}
|
||||
|
|
Référencer dans un nouveau ticket