split handle and username into two fields
This commit is contained in:
parent
f29f31d32c
commit
cb901a727c
10
fun.go
10
fun.go
|
@ -38,12 +38,14 @@ func reverbolate(honks []*Honk) {
|
|||
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 @@ func originate(u string) string {
|
|||
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 {
|
||||
|
|
1
honk.go
1
honk.go
|
@ -54,6 +54,7 @@ type Honk struct {
|
|||
Username string
|
||||
What string
|
||||
Honker string
|
||||
Handle string
|
||||
Oonker string
|
||||
XID string
|
||||
RID string
|
||||
|
|
|
@ -54,7 +54,7 @@ convoy: <a href="/t?c={{ .Convoy }}">{{ .Convoy }}</a>
|
|||
{{ 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 }}">
|
||||
|
|
Loading…
Reference in New Issue