we may need to expand short mentions more than once
This commit is contained in:
parent
dfca8b10f0
commit
4dc2ada944
47
fun.go
47
fun.go
|
@ -329,27 +329,34 @@ func memetize(honk *Honk) {
|
||||||
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 {
|
||||||
return re_quickmention.ReplaceAllStringFunc(s, func(m string) string {
|
nonstop := true
|
||||||
prefix := ""
|
for nonstop {
|
||||||
if m[0] == ' ' {
|
nonstop = false
|
||||||
prefix = " "
|
s = re_quickmention.ReplaceAllStringFunc(s, func(m string) string {
|
||||||
m = m[1:]
|
log.Printf("m: %s", m)
|
||||||
}
|
prefix := ""
|
||||||
prefix += "@"
|
if m[0] == ' ' {
|
||||||
m = m[1:]
|
prefix = " "
|
||||||
m = m[:len(m)-1]
|
m = m[1:]
|
||||||
|
|
||||||
row := stmtOneHonker.QueryRow(m, userid)
|
|
||||||
var xid string
|
|
||||||
err := row.Scan(&xid)
|
|
||||||
if err == nil {
|
|
||||||
_, name := handles(xid)
|
|
||||||
if name != "" {
|
|
||||||
m = name
|
|
||||||
}
|
}
|
||||||
}
|
prefix += "@"
|
||||||
return prefix + m + " "
|
m = m[1:]
|
||||||
})
|
m = m[:len(m)-1]
|
||||||
|
|
||||||
|
row := stmtOneHonker.QueryRow(m, userid)
|
||||||
|
var xid string
|
||||||
|
err := row.Scan(&xid)
|
||||||
|
if err == nil {
|
||||||
|
_, name := handles(xid)
|
||||||
|
if name != "" {
|
||||||
|
nonstop = true
|
||||||
|
m = name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return prefix + m + " "
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func mentionize(s string) string {
|
func mentionize(s string) string {
|
||||||
|
|
Loading…
Reference in New Issue