From ef25eddfd66b4cb7d988495d1e3b9133bdb3ccfe Mon Sep 17 00:00:00 2001 From: kilo Date: Wed, 26 Jul 2017 03:59:46 +0200 Subject: [PATCH] =?UTF-8?q?Editing=20a=20torrent=20now=20redirects=20to=20?= =?UTF-8?q?torrent=20view=20page=20(fix=C2=A0#1282)=20(#1286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix #1282 * Update edit.go * Update view.go * Update view.go --- controllers/torrent/edit.go | 4 +++- controllers/torrent/view.go | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/controllers/torrent/edit.go b/controllers/torrent/edit.go index a897ff22..4d7abad2 100644 --- a/controllers/torrent/edit.go +++ b/controllers/torrent/edit.go @@ -3,6 +3,7 @@ package torrentController import ( "net/http" "strconv" + "fmt" "github.com/NyaaPantsu/nyaa/controllers/router" "github.com/NyaaPantsu/nyaa/models" @@ -49,7 +50,8 @@ func TorrentPostEditUserPanel(c *gin.Context) { } if !messages.HasErrors() { upload.UpdateTorrent(&uploadForm, torrent, currentUser).Update(currentUser.HasAdmin()) - messages.AddInfoT("infos", "torrent_updated") + c.Redirect(http.StatusSeeOther, fmt.Sprintf("/view/%d?success_edit", id)) + return } templates.Form(c, "site/torrents/edit.jet.html", uploadForm.Update) } else { diff --git a/controllers/torrent/view.go b/controllers/torrent/view.go index 40597c85..2f23370a 100644 --- a/controllers/torrent/view.go +++ b/controllers/torrent/view.go @@ -23,6 +23,9 @@ func ViewHandler(c *gin.Context) { if c.Request.URL.Query()["success"] != nil { messages.AddInfoT("infos", "torrent_uploaded") } + if c.Request.URL.Query()["success_edit"] != nil { + messages.AddInfoT("infos", "torrent_updated") + } if c.Request.URL.Query()["badcaptcha"] != nil { messages.AddErrorT("errors", "bad_captcha") }