split handle and username into two fields
Ted Unangst tedu@tedunangst.com
Mon, 03 Jun 2019 00:22:00 -0400
3 files changed,
8 insertions(+),
5 deletions(-)
M
fun.go
→
fun.go
@@ -38,12 +38,14 @@ h.What += "ed"
if h.Whofore == 2 || h.Whofore == 3 { h.URL = h.XID h.Noise = mentionize(h.Noise) + h.Username, h.Handle = honkerhandle(h.Honker) } else { idx := strings.LastIndexByte(h.Honker, '/') if idx != -1 { - h.Username = honkerhandle(h.Honker) + h.Username, h.Handle = honkerhandle(h.Honker) } else { h.Username = h.Honker + h.Handle = h.Honker } if h.URL == "" { h.URL = h.XID@@ -315,12 +317,12 @@ }
return "" } -func honkerhandle(h string) string { +func honkerhandle(h string) (string, string) { m := re_unurl.FindStringSubmatch(h) if len(m) > 2 { - return m[2] + return m[2], fmt.Sprintf("%s@%s", m[2], m[1]) } - return h + return "", h } func prepend(s string, x []string) []string {
M
views/honk.html
→
views/honk.html
@@ -54,7 +54,7 @@ <p>
{{ if .Honk.Public }} <button onclick="bonk(this, '{{ .Honk.XID }}'); return false;"><a href="/bonk">bonk</a></button> {{ end }} -<button onclick="showhonkform('{{ .Honk.XID }}', '{{ .Honk.Username }}'); return false;"><a href="/newhonk">tonk</a></button> +<button onclick="showhonkform('{{ .Honk.XID }}', '{{ .Honk.Handle }}'); return false;"><a href="/newhonk">tonk</a></button> <form class="inlineform" action="/zonkit" method="POST"> <input type="hidden" name="CSRF" value="{{ .BonkCSRF }}"> <input type="hidden" name="honk" value="{{ .Honk.XID }}">