diff --git a/controllers/moderator/torrents.go b/controllers/moderator/torrents.go
index de8112bf..7edc3108 100644
--- a/controllers/moderator/torrents.go
+++ b/controllers/moderator/torrents.go
@@ -75,6 +75,7 @@ func TorrentEditModPanel(c *gin.Context) {
torrentJSON := torrent.ToJSON()
uploadForm := upload.NewTorrentRequest()
+ uploadForm.ID = torrentJSON.ID
uploadForm.Name = torrentJSON.Name
uploadForm.Category = torrentJSON.Category + "_" + torrentJSON.SubCategory
uploadForm.Status = torrentJSON.Status
@@ -97,7 +98,9 @@ func TorrentPostEditModPanel(c *gin.Context) {
currentUser := router.GetUser(c)
if torrent.ID > 0 {
errUp := upload.ExtractEditInfo(c, &uploadForm.Update)
- uploadForm.ID = uint(id)
+ uploadForm.ID = torrent.ID
+ uploadForm.Update.ID = torrent.ID
+
if errUp != nil {
messages.AddErrorT("errors", "fail_torrent_update")
}
diff --git a/templates/admin/paneltorrentedit.jet.html b/templates/admin/paneltorrentedit.jet.html
index 16ec5846..3c8b1342 100644
--- a/templates/admin/paneltorrentedit.jet.html
+++ b/templates/admin/paneltorrentedit.jet.html
@@ -50,7 +50,7 @@
{{ T("torrent_tags")}}
-
+
{{ yield errors(name="tags")}}
diff --git a/templates/site/torrents/edit.jet.html b/templates/site/torrents/edit.jet.html
index 359cdb62..f1d0d6da 100644
--- a/templates/site/torrents/edit.jet.html
+++ b/templates/site/torrents/edit.jet.html
@@ -54,7 +54,7 @@
{{ T("torrent_tags")}}
-
+
{{ yield errors(name="tags")}}
diff --git a/templates/template_functions_test.go b/templates/template_functions_test.go
index 2e7124ec..049d67cb 100644
--- a/templates/template_functions_test.go
+++ b/templates/template_functions_test.go
@@ -15,15 +15,10 @@ import (
"github.com/NyaaPantsu/nyaa/models"
"github.com/NyaaPantsu/nyaa/utils/categories"
"github.com/NyaaPantsu/nyaa/utils/publicSettings"
- "github.com/gin-gonic/gin"
)
// run before router/init.go:init()
var _ = func() (_ struct{}) {
- gin.SetMode(gin.TestMode)
- config.Configpaths[1] = path.Join("..", config.Configpaths[1])
- config.Configpaths[0] = path.Join("..", config.Configpaths[0])
- config.Reload()
categories.InitCategories()
return
}()
diff --git a/utils/validator/torrent/forms.go b/utils/validator/torrent/forms.go
index 1c2c2d4c..1f3d83ee 100644
--- a/utils/validator/torrent/forms.go
+++ b/utils/validator/torrent/forms.go
@@ -3,6 +3,7 @@ package torrentValidator
// TorrentRequest struct
// Same json name as the constant!
type TorrentRequest struct {
+ ID uint `validate:"-" form:"-" json:"-"`
Name string `validate:"required" form:"name" json:"name,omitempty"`
Magnet string `json:"magnet,omitempty" form:"magnet"`
Category string `validate:"required" form:"c" json:"c"`