allow renames at end of noise
This commit is contained in:
parent
4dc2ada944
commit
543a16f6f4
7
fun.go
7
fun.go
|
@ -326,14 +326,13 @@ func memetize(honk *Honk) {
|
||||||
honk.Noise = re_memes.ReplaceAllStringFunc(honk.Noise, repl)
|
honk.Noise = re_memes.ReplaceAllStringFunc(honk.Noise, repl)
|
||||||
}
|
}
|
||||||
|
|
||||||
var re_quickmention = regexp.MustCompile("(^| )@[[:alnum:]]+ ")
|
var re_quickmention = regexp.MustCompile("(^| )@[[:alnum:]]+( |$)")
|
||||||
|
|
||||||
func quickrename(s string, userid int64) string {
|
func quickrename(s string, userid int64) string {
|
||||||
nonstop := true
|
nonstop := true
|
||||||
for nonstop {
|
for nonstop {
|
||||||
nonstop = false
|
nonstop = false
|
||||||
s = re_quickmention.ReplaceAllStringFunc(s, func(m string) string {
|
s = re_quickmention.ReplaceAllStringFunc(s, func(m string) string {
|
||||||
log.Printf("m: %s", m)
|
|
||||||
prefix := ""
|
prefix := ""
|
||||||
if m[0] == ' ' {
|
if m[0] == ' ' {
|
||||||
prefix = " "
|
prefix = " "
|
||||||
|
@ -341,7 +340,9 @@ func quickrename(s string, userid int64) string {
|
||||||
}
|
}
|
||||||
prefix += "@"
|
prefix += "@"
|
||||||
m = m[1:]
|
m = m[1:]
|
||||||
m = m[:len(m)-1]
|
if m[len(m)-1] == ' ' {
|
||||||
|
m = m[:len(m)-1]
|
||||||
|
}
|
||||||
|
|
||||||
row := stmtOneHonker.QueryRow(m, userid)
|
row := stmtOneHonker.QueryRow(m, userid)
|
||||||
var xid string
|
var xid string
|
||||||
|
|
Loading…
Reference in New Issue