all honk operations on all the pages

This commit is contained in:
Ted Unangst 2019-04-23 16:48:25 -04:00
parent bb5ea46316
commit 8f12af0612

11
honk.go
View file

@ -422,14 +422,14 @@ func viewhonker(w http.ResponseWriter, r *http.Request) {
name := mux.Vars(r)["name"] name := mux.Vars(r)["name"]
u := GetUserInfo(r) u := GetUserInfo(r)
honks := gethonksbyhonker(u.UserID, name) honks := gethonksbyhonker(u.UserID, name)
honkpage(w, r, nil, nil, honks) honkpage(w, r, u, nil, honks)
} }
func viewcombo(w http.ResponseWriter, r *http.Request) { func viewcombo(w http.ResponseWriter, r *http.Request) {
name := mux.Vars(r)["name"] name := mux.Vars(r)["name"]
u := GetUserInfo(r) u := GetUserInfo(r)
honks := gethonksbycombo(u.UserID, name) honks := gethonksbycombo(u.UserID, name)
honkpage(w, r, nil, nil, honks) honkpage(w, r, u, nil, honks)
} }
func fingerlicker(w http.ResponseWriter, r *http.Request) { func fingerlicker(w http.ResponseWriter, r *http.Request) {
@ -502,14 +502,17 @@ func viewhonk(w http.ResponseWriter, r *http.Request) {
WriteJunk(w, j) WriteJunk(w, j)
return return
} }
honkpage(w, r, nil, nil, []*Honk{h}) u := GetUserInfo(r)
honkpage(w, r, u, nil, []*Honk{h})
} }
func honkpage(w http.ResponseWriter, r *http.Request, u *UserInfo, user *WhatAbout, honks []*Honk) { func honkpage(w http.ResponseWriter, r *http.Request, u *UserInfo, user *WhatAbout, honks []*Honk) {
reverbolate(honks) reverbolate(honks)
templinfo := getInfo(r) templinfo := getInfo(r)
if u != nil && u.Username == user.Name { if u != nil {
if user != nil && u.Username == user.Name {
templinfo["UserCSRF"] = GetCSRF("saveuser", r) templinfo["UserCSRF"] = GetCSRF("saveuser", r)
}
templinfo["HonkCSRF"] = GetCSRF("honkhonk", r) templinfo["HonkCSRF"] = GetCSRF("honkhonk", r)
} }
if u == nil { if u == nil {