start including servermsg in updates
Ted Unangst tedu@tedunangst.com
Mon, 07 Oct 2019 12:34:36 -0400
4 files changed,
17 insertions(+),
2 deletions(-)
M
views/honkfrags.html
→
views/honkfrags.html
@@ -1,5 +1,6 @@
<div>{{ .TopXID }}</div> {{ $BonkCSRF := .HonkCSRF }} +<div><p>{{ .ServerMessage }}</div> <div> {{ range .Honks }} {{ template "honk.html" map "Honk" . "BonkCSRF" $BonkCSRF }}
M
views/honkpage.html
→
views/honkpage.html
@@ -5,7 +5,7 @@ {{ if .Name }}
<p>{{ .Name }} <span style="margin-left:1em;"><a href="/u/{{ .Name }}/rss">rss</a></span> <p>{{ .WhatAbout }} {{ end }} -<p>{{ .ServerMessage }} +<div id="srvmsg"><p>{{ .ServerMessage }}</div> {{ if .HonkCSRF }} {{ template "honkform.html" . }} {{ end }}
M
views/honkpage.js
→
views/honkpage.js
@@ -67,7 +67,13 @@ function fillinhonks(xhr) {
var doc = xhr.responseXML var stash = curpagestate.name + ":" + curpagestate.arg topxid[stash] = doc.children[0].children[1].children[0].innerText - var honks = doc.children[0].children[1].children[1].children + var srvmsg = doc.children[0].children[1].children[1] + var honks = doc.children[0].children[1].children[2].children + + var srvel = document.getElementById("srvmsg") + srvel.children[0].remove() + srvel.prepend(srvmsg) + var honksonpage = document.getElementById("honksonpage") var holder = honksonpage.children[0] var lenhonks = honks.length
M
web.go
→
web.go
@@ -1509,24 +1509,32 @@ var honks []*Honk
switch page { case "atme": honks = gethonksforme(userid) + templinfo["ServerMessage"] = "at me!" case "home": honks = gethonksforuser(userid) honks = osmosis(honks, userid) + templinfo["ServerMessage"] = serverMsg case "first": honks = gethonksforuserfirstclass(userid) honks = osmosis(honks, userid) + templinfo["ServerMessage"] = "first class only" case "combo": c := r.FormValue("c") honks = gethonksbycombo(userid, c) + templinfo["ServerMessage"] = "honks by combo: " + c case "convoy": c := r.FormValue("c") honks = gethonksbyconvoy(userid, c) + templinfo["ServerMessage"] = "honks in convoy: " + c case "honker": xid := r.FormValue("xid") if strings.IndexByte(xid, '@') != -1 { xid = gofish(xid) } honks = gethonksbyxonker(userid, xid) + xid = html.EscapeString(xid) + msg := fmt.Sprintf(`honks by honker: <a href="%s" ref="noreferrer">%s</a>`, xid, xid) + templinfo["ServerMessage"] = template.HTML(msg) default: http.NotFound(w, r) }