Add hydration (refresh) support to user pages

This commit is contained in:
Peter Sanchez 2022-04-27 19:11:47 -06:00
parent 6b333c62f3
commit c0fc930e36
2 changed files with 8 additions and 0 deletions

View File

@ -148,6 +148,8 @@ function hydrargs() {
args["c"] = arg
} else if (name == "honker") {
args["xid"] = arg
} else if (name == "user") {
args["uname"] = arg
}
return args
}

6
web.go
View File

@ -712,6 +712,8 @@ func showuser(w http.ResponseWriter, r *http.Request) {
u := login.GetUserInfo(r)
honks := gethonksbyuser(name, u != nil && u.Username == name, 0)
templinfo := getInfo(r)
templinfo["PageName"] = "user"
templinfo["PageArg"] = name
templinfo["Name"] = user.Name
templinfo["WhatAbout"] = user.HTAbout
templinfo["ServerMessage"] = ""
@ -2272,6 +2274,10 @@ func webhydra(w http.ResponseWriter, r *http.Request) {
</form>`, login.GetCSRF("submithonker", r), xid)
msg := templates.Sprintf(`honks by honker: <a href="%s" ref="noreferrer">%s</a>%s`, xid, xid, miniform)
hydra.Srvmsg = msg
case "user":
uname := r.FormValue("uname")
honks = gethonksbyuser(uname, u != nil && u.Username == uname, wanted)
hydra.Srvmsg = templates.Sprintf("honks by user: %s", uname)
default:
http.NotFound(w, r)
}