i don't even remember what i fix anymore'
Cette révision appartient à :
Parent
755a426931
révision
f326d801c2
5 fichiers modifiés avec 39 ajouts et 15 suppressions
|
@ -52,7 +52,6 @@ func IndexModPanel(w http.ResponseWriter, r *http.Request) {
|
|||
users, _ := userService.RetrieveUsersForAdmin(offset, 0)
|
||||
comments, _ := commentService.GetAllComments(offset, 0, "", "")
|
||||
torrentReports, _, _ := reportService.GetAllTorrentReports(offset, 0)
|
||||
fmt.Println(torrentReports)
|
||||
|
||||
languages.SetTranslationFromRequest(panelIndex, r, "en-us")
|
||||
htv := PanelIndexVbs{torrents, torrentReports, users, comments, NewSearchForm(), currentUser, r.URL}
|
||||
|
@ -243,6 +242,7 @@ func CommentDeleteModPanel(w http.ResponseWriter, r *http.Request) {
|
|||
http.Error(w, "admins only", http.StatusForbidden)
|
||||
}
|
||||
}
|
||||
|
||||
func TorrentDeleteModPanel(w http.ResponseWriter, r *http.Request) {
|
||||
currentUser := GetUser(r)
|
||||
id := r.URL.Query().Get("id")
|
||||
|
@ -262,3 +262,19 @@ func TorrentDeleteModPanel(w http.ResponseWriter, r *http.Request) {
|
|||
http.Error(w, "admins only", http.StatusForbidden)
|
||||
}
|
||||
}
|
||||
|
||||
func TorrentReportDeleteModPanel(w http.ResponseWriter, r *http.Request) {
|
||||
currentUser := GetUser(r)
|
||||
if userPermission.HasAdmin(currentUser) {
|
||||
id := r.URL.Query().Get("id")
|
||||
fmt.Println(id)
|
||||
idNum, _ := strconv.ParseUint(id, 10, 64)
|
||||
_ = form.NewErrors()
|
||||
_, _ = reportService.DeleteTorrentReport(uint(idNum))
|
||||
|
||||
url, _ := Router.Get("mod_trlist").URL()
|
||||
http.Redirect(w, r, url.String()+"?deleted", http.StatusSeeOther)
|
||||
} else {
|
||||
http.Error(w, "admins only", http.StatusForbidden)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ func init() {
|
|||
gzipTorrentPostEditModPanel := handlers.CompressHandler(http.HandlerFunc(TorrentPostEditModPanel))
|
||||
gzipCommentDeleteModPanel := handlers.CompressHandler(http.HandlerFunc(CommentDeleteModPanel))
|
||||
gzipTorrentDeleteModPanel := handlers.CompressHandler(http.HandlerFunc(TorrentDeleteModPanel))
|
||||
gzipTorrentReportDeleteModPanel := handlers.CompressHandler(http.HandlerFunc(TorrentReportDeleteModPanel))
|
||||
|
||||
//gzipTorrentReportCreateHandler := handlers.CompressHandler(http.HandlerFunc(CreateTorrentReportHandler))
|
||||
//gzipTorrentReportDeleteHandler := handlers.CompressHandler(http.HandlerFunc(DeleteTorrentReportHandler))
|
||||
|
@ -88,14 +89,17 @@ func init() {
|
|||
Router.Handle("/mod", gzipIndexModPanel).Name("mod_index")
|
||||
Router.Handle("/mod/torrents", gzipTorrentsListPanel).Name("mod_tlist")
|
||||
Router.Handle("/mod/torrents/{page}", gzipTorrentsListPanel).Name("mod_tlist_page")
|
||||
Router.Handle("/mod/reports", gzipTorrentReportListPanel).Name("mod_trlist")
|
||||
Router.Handle("/mod/reports/{page}", gzipTorrentReportListPanel).Name("mod_trlist_page")
|
||||
Router.Handle("/mod/users", gzipUsersListPanel).Name("mod_ulist")
|
||||
Router.Handle("/mod/users/{page}", gzipUsersListPanel).Name("mod_ulist_page")
|
||||
Router.Handle("/mod/comments", gzipCommentsListPanel).Name("mod_clist")
|
||||
Router.Handle("/mod/comments/{page}", gzipCommentsListPanel).Name("mod_clist_page")
|
||||
Router.Handle("/mod/comment", gzipCommentsListPanel).Name("mod_cedit") // TODO
|
||||
Router.Handle("/mod/torrent/", gzipTorrentEditModPanel).Name("mod_tedit")
|
||||
Router.Handle("/mod/torrent/", gzipTorrentPostEditModPanel).Name("mod_ptedit")
|
||||
Router.Handle("/mod/torrent/", gzipTorrentEditModPanel).Name("mod_tedit").Methods("GET")
|
||||
Router.Handle("/mod/torrent/", gzipTorrentPostEditModPanel).Name("mod_ptedit").Methods("POST")
|
||||
Router.Handle("/mod/torrent/delete", gzipTorrentDeleteModPanel).Name("mod_tdelete")
|
||||
Router.Handle("/mod/report/delete", gzipTorrentReportDeleteModPanel).Name("mod_trdelete")
|
||||
Router.Handle("/mod/comment/delete", gzipCommentDeleteModPanel).Name("mod_cdelete")
|
||||
|
||||
//reporting a torrent
|
||||
|
@ -107,8 +111,6 @@ func init() {
|
|||
// TODO Allow only moderators to access /moderation/*
|
||||
//Router.Handle("/moderation/report/delete", gzipTorrentReportDeleteHandler).Name("torrent_report_delete").Methods("POST")
|
||||
//Router.Handle("/moderation/torrent/delete", gzipTorrentDeleteHandler).Name("torrent_delete").Methods("POST")
|
||||
Router.Handle("/mod/reports", gzipTorrentReportListPanel).Name("mod_trlist").Methods("GET")
|
||||
Router.Handle("/mod/reports/{page}", gzipTorrentReportListPanel).Name("mod_trlist_page").Methods("GET")
|
||||
|
||||
Router.NotFoundHandler = http.HandlerFunc(NotFoundHandler)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{{ range .TorrentReports}}
|
||||
|
||||
<tr><td><a href="{{ genRoute "mod_tedit" }}?id={{.Torrent.ID}}">{{ .Torrent.Name }}</a></td><td>{{.User.Username}}</td><td>{{.Description}}</td>
|
||||
<td><a href="{{ genRoute "mod_tdelete" }}?id={{ .ID }}" class="btn btn-danger btn-lg" onclick="if (!confirm('Are you sure?')) return false;"><i class="glyphicon glyphicon-trash"></i>{{ T "delete" }}</a></td></tr>
|
||||
<td><a href="{{ genRoute "mod_trdelete" }}?id={{ .ID }}" class="btn btn-danger btn-lg" onclick="if (!confirm('Are you sure?')) return false;"><i class="glyphicon glyphicon-trash"></i>{{ T "delete" }}</a></td></tr>
|
||||
{{end}}
|
||||
</table>
|
||||
<nav class="torrentNav" aria-label="Page navigation">
|
||||
|
|
|
@ -2,7 +2,13 @@
|
|||
{{define "content"}}
|
||||
<table class="table">
|
||||
{{ range .TorrentReports}}
|
||||
<tr><td><a href="{{ genRoute "mod_tedit"}}?id={{.Torrent.ID}}">{{.Torrent.Name}}</a></td><td>{{.User.Username}}</td><td>{{.Description}}</td><td><a href="{{ genRoute "mod_tdelete" }}?id={{ .Torrent.ID }}">Delete</a></td></tr>
|
||||
<tr>
|
||||
<td><a href="{{ genRoute "mod_tedit"}}?id={{.Torrent.ID}}">{{.Torrent.Name}}</a></td>
|
||||
<td>{{.User.Username}}</td>
|
||||
<td>{{.Description}}</td>
|
||||
<td><a href="{{ genRoute "mod_tdelete" }}?id={{ .Torrent.ID }}">Delete</a></td>
|
||||
<td><a href="{{ genRoute "mod_trdelete" }}?id={{ .ID }}">Delete Report</a></td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
{{end}}
|
||||
|
|
|
@ -36,16 +36,16 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{{.URL.Parse "/"}}">Nyaa Pantsu Moderation</a>
|
||||
<a class="navbar-brand" href="{{ genRoute "mod_index" }}">Nyaa Pantsu Moderation</a>
|
||||
<a class="navbar-brand hidden-md pull-right nightswitch" href="javascript:toggleNightMode();" ></a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="{{.URL.Parse "/"}}">{{T "website"}}</a/></li>
|
||||
<li><a href="{{ genRoute "mod_tlist"}}">{{T "torrents"}}</a></li>
|
||||
<li><a href="{{ genRoute "mod_ulist"}}">{{T "users"}}</a></li>
|
||||
<li><a href="{{ genRoute "mod_clist"}}">{{T "comments"}}</a></li>
|
||||
<li><a href="{{ genRoute "mod_trlist"}}">{{T "torrent_reports"}}</a></li>
|
||||
<li><a href="{{.URL.Parse "/"}}">{{T "Nyaa Pantsu"}}</a/></li>
|
||||
<li><a href="{{ genRoute "mod_tlist"}}">{{T "Torrents"}}</a></li>
|
||||
<li><a href="{{ genRoute "mod_ulist"}}">{{T "Users"}}</a></li>
|
||||
<li><a href="{{ genRoute "mod_clist"}}">{{T "Comments"}}</a></li>
|
||||
<li><a href="{{ genRoute "mod_trlist"}}">{{T "Torrent Reports"}}</a></li>
|
||||
</ul>
|
||||
{{block "badge_user" .}}{{end}}
|
||||
<form class="navbar-form navbar-right" role="search" action="/mod/torrents" method="get">
|
||||
|
|
Référencer dans un nouveau ticket