From c0fc930e360b115d9a1dd5b3c766eceef0a711b1 Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Wed, 27 Apr 2022 19:11:47 -0600 Subject: [PATCH] Add hydration (refresh) support to user pages --- views/honkpage.js | 2 ++ web.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/views/honkpage.js b/views/honkpage.js index f0283e3..9d2bc66 100644 --- a/views/honkpage.js +++ b/views/honkpage.js @@ -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 } diff --git a/web.go b/web.go index 4637b41..d07c132 100644 --- a/web.go +++ b/web.go @@ -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) { `, login.GetCSRF("submithonker", r), xid) msg := templates.Sprintf(`honks by honker: %s%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) }