fix travis error
Cette révision appartient à :
Parent
94097dc2bb
révision
d0a647bf8e
5 fichiers modifiés avec 7 ajouts et 8 suppressions
|
@ -75,6 +75,7 @@ func TorrentEditModPanel(c *gin.Context) {
|
||||||
|
|
||||||
torrentJSON := torrent.ToJSON()
|
torrentJSON := torrent.ToJSON()
|
||||||
uploadForm := upload.NewTorrentRequest()
|
uploadForm := upload.NewTorrentRequest()
|
||||||
|
uploadForm.ID = torrentJSON.ID
|
||||||
uploadForm.Name = torrentJSON.Name
|
uploadForm.Name = torrentJSON.Name
|
||||||
uploadForm.Category = torrentJSON.Category + "_" + torrentJSON.SubCategory
|
uploadForm.Category = torrentJSON.Category + "_" + torrentJSON.SubCategory
|
||||||
uploadForm.Status = torrentJSON.Status
|
uploadForm.Status = torrentJSON.Status
|
||||||
|
@ -97,7 +98,9 @@ func TorrentPostEditModPanel(c *gin.Context) {
|
||||||
currentUser := router.GetUser(c)
|
currentUser := router.GetUser(c)
|
||||||
if torrent.ID > 0 {
|
if torrent.ID > 0 {
|
||||||
errUp := upload.ExtractEditInfo(c, &uploadForm.Update)
|
errUp := upload.ExtractEditInfo(c, &uploadForm.Update)
|
||||||
uploadForm.ID = uint(id)
|
uploadForm.ID = torrent.ID
|
||||||
|
uploadForm.Update.ID = torrent.ID
|
||||||
|
|
||||||
if errUp != nil {
|
if errUp != nil {
|
||||||
messages.AddErrorT("errors", "fail_torrent_update")
|
messages.AddErrorT("errors", "fail_torrent_update")
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
</div>
|
</div>
|
||||||
<h3>{{ T("torrent_tags")}}</h3>
|
<h3>{{ T("torrent_tags")}}</h3>
|
||||||
<span id="tags_list"></span>
|
<span id="tags_list"></span>
|
||||||
<a id="tagPopup" href="#" class="add-tag">{{ T("add") }}</a>
|
<a id="tagPopup" href="#" class="add-tag">{{ T("add") }}</a> <a id="tagPopup" href="/mod/tags/delete?id={{ Form.ID }}" class="form-input btn-red">{{ T("delete_all") }}</a>
|
||||||
<input type="hidden" name="tags" id="tags" value="{{ Form.Tags }}">
|
<input type="hidden" name="tags" id="tags" value="{{ Form.Tags }}">
|
||||||
{{ yield errors(name="tags")}}
|
{{ yield errors(name="tags")}}
|
||||||
<button type="submit" class="form-input up-input btn-green">{{ T("save_changes")}}</button>
|
<button type="submit" class="form-input up-input btn-green">{{ T("save_changes")}}</button>
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
<h3>{{ T("torrent_tags")}}</h3>
|
<h3>{{ T("torrent_tags")}}</h3>
|
||||||
<span id="tags_list"></span>
|
<span id="tags_list"></span>
|
||||||
<a id="tagPopup" href="#" class="add-tag">{{ T("add") }}</a> <a id="tagPopup" href="/mod/tags/delete?id={{ Form.ID }}" class="form-input btn-red">{{ T("delete_all") }}</a>
|
<a id="tagPopup" href="#" class="add-tag">{{ T("add") }}</a>
|
||||||
<input type="hidden" name="tags" id="tags" value="{{ Form.Tags }}">
|
<input type="hidden" name="tags" id="tags" value="{{ Form.Tags }}">
|
||||||
{{ yield errors(name="tags")}}
|
{{ yield errors(name="tags")}}
|
||||||
<button type="submit" class="form-input up-input">{{ T("save_changes")}}</button>
|
<button type="submit" class="form-input up-input">{{ T("save_changes")}}</button>
|
||||||
|
|
|
@ -15,15 +15,10 @@ import (
|
||||||
"github.com/NyaaPantsu/nyaa/models"
|
"github.com/NyaaPantsu/nyaa/models"
|
||||||
"github.com/NyaaPantsu/nyaa/utils/categories"
|
"github.com/NyaaPantsu/nyaa/utils/categories"
|
||||||
"github.com/NyaaPantsu/nyaa/utils/publicSettings"
|
"github.com/NyaaPantsu/nyaa/utils/publicSettings"
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// run before router/init.go:init()
|
// run before router/init.go:init()
|
||||||
var _ = func() (_ struct{}) {
|
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()
|
categories.InitCategories()
|
||||||
return
|
return
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -3,6 +3,7 @@ package torrentValidator
|
||||||
// TorrentRequest struct
|
// TorrentRequest struct
|
||||||
// Same json name as the constant!
|
// Same json name as the constant!
|
||||||
type TorrentRequest struct {
|
type TorrentRequest struct {
|
||||||
|
ID uint `validate:"-" form:"-" json:"-"`
|
||||||
Name string `validate:"required" form:"name" json:"name,omitempty"`
|
Name string `validate:"required" form:"name" json:"name,omitempty"`
|
||||||
Magnet string `json:"magnet,omitempty" form:"magnet"`
|
Magnet string `json:"magnet,omitempty" form:"magnet"`
|
||||||
Category string `validate:"required" form:"c" json:"c"`
|
Category string `validate:"required" form:"c" json:"c"`
|
||||||
|
|
Référencer dans un nouveau ticket