Parse multiple entries[n] with numbers for n
This commit is contained in:
parent
69dbbae6b7
commit
191297bc32
|
|
@ -37,6 +37,7 @@ var (
|
||||||
pool *redis.Pool
|
pool *redis.Pool
|
||||||
port int
|
port int
|
||||||
redisServer = flag.String("redis", "redis:6379", "")
|
redisServer = flag.String("redis", "redis:6379", "")
|
||||||
|
entryRegex = regexp.MustCompile("^entry\\[\\d+\\]$")
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
@ -373,10 +374,14 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
h.Backend.MarkRead(channel, uids)
|
h.Backend.MarkRead(channel, uids)
|
||||||
} else if uids, e := values["entry[]"]; e {
|
} else if uids, e := values["entry[]"]; e {
|
||||||
h.Backend.MarkRead(channel, uids)
|
h.Backend.MarkRead(channel, uids)
|
||||||
} else if uids, e := values["entry[0]"]; e {
|
|
||||||
h.Backend.MarkRead(channel, uids)
|
|
||||||
} else {
|
} else {
|
||||||
log.Println("timeline mark_read value not found")
|
uids := []string{}
|
||||||
|
for k, v := range values {
|
||||||
|
if entryRegex.MatchString(k) {
|
||||||
|
uids = append(uids, v...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
h.Backend.MarkRead(channel, uids)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Printf("unknown method in timeline %s\n", method)
|
log.Printf("unknown method in timeline %s\n", method)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user