Deprecate bad quality flag

This commit is contained in:
Las Zenow 2016-07-30 07:46:35 -04:00
parent 7f9c172853
commit f12114c296
3 changed files with 3 additions and 34 deletions

View file

@ -21,8 +21,6 @@ type Book struct {
Active bool
UploadDate time.Time
Tsv string
//BadQuality int `bad_quality`
BadQualityReporters []string `sql:"-"` // TODO: deprecate??
}
// TODO: missing history

View file

@ -50,10 +50,9 @@ func logoutHandler(h handler) {
}
type bookData struct {
S Status
Book database.Book
Description []string
FlaggedBadQuality bool
S Status
Book database.Book
Description []string
}
func bookHandler(h handler) {
@ -74,13 +73,6 @@ func bookHandler(h handler) {
data.S.Title = book.Title + author + " -- " + data.S.Title
data.Description = strings.Split(data.Book.Description, "\n")
data.FlaggedBadQuality = false
for _, reporter := range book.BadQualityReporters {
if reporter == h.sess.User || reporter == h.sess.Id() {
data.FlaggedBadQuality = true
break
}
}
h.template.load(h, "book", data)
}
@ -113,21 +105,6 @@ func downloadHandler(h handler) {
io.Copy(h.w, f)
}
func flagHandler(h handler) {
id := mux.Vars(h.r)["id"]
user := h.sess.Id()
if h.sess.User != "" {
user = h.sess.User
}
err := h.db.FlagBadQuality(id, user)
if err != nil {
log.Warn("An error ocurred while flaging ", id, ": ", err)
}
h.sess.Notify("Flagged!", "Book marked as bad quality, thank you", "success")
h.sess.Save(h.w, h.r)
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
}
type indexData struct {
S Status
Books []database.Book
@ -202,7 +179,6 @@ func InitRouter(db database.DB, sg *StatsGatherer, assetsPath string) {
r.HandleFunc("/download/{id:"+idPattern+"}/{epub:.*}", sg.Gather(downloadHandler))
r.HandleFunc("/cover/{id:"+idPattern+"}/{size}/{img:.*}", sg.Gather(coverHandler))
r.HandleFunc("/stats/", sg.Gather(statsHandler))
r.HandleFunc("/flag/bad_quality/{id:"+idPattern+"}", sg.Gather(flagHandler))
r.HandleFunc("/login/", sg.Gather(loginHandler)).Methods("GET")
r.HandleFunc("/login/", sg.Gather(loginPostHandler)).Methods("POST")