all repos — honk @ 6f3ad0cbff9c35feba3e37ffc67b4d6456e5f7a6

my fork of honk

start including servermsg in updates
Ted Unangst tedu@tedunangst.com
Mon, 07 Oct 2019 12:34:36 -0400
commit

6f3ad0cbff9c35feba3e37ffc67b4d6456e5f7a6

parent

09528de4efe138715b8d07c81acea8505aa484ea

4 files changed, 17 insertions(+), 2 deletions(-)

jump to
M views/honkfrags.htmlviews/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.htmlviews/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.jsviews/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.goweb.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) }