Update channels count with new items for include matching
All checks were successful
the build was successful
All checks were successful
the build was successful
This commit is contained in:
parent
3addbb50de
commit
03c7375064
|
@ -650,6 +650,7 @@ func (b *memoryBackend) channelAddItemWithMatcher(conn redis.Conn, channel strin
|
||||||
// if regex matches item
|
// if regex matches item
|
||||||
// - add item to channel
|
// - add item to channel
|
||||||
|
|
||||||
|
var updatedChannels []string
|
||||||
for channelKey, setting := range b.Settings {
|
for channelKey, setting := range b.Settings {
|
||||||
if setting.IncludeRegex != "" {
|
if setting.IncludeRegex != "" {
|
||||||
included := false
|
included := false
|
||||||
|
@ -666,10 +667,17 @@ func (b *memoryBackend) channelAddItemWithMatcher(conn redis.Conn, channel strin
|
||||||
if included {
|
if included {
|
||||||
log.Printf("Included %#v\n", item)
|
log.Printf("Included %#v\n", item)
|
||||||
b.channelAddItem(conn, channelKey, item)
|
b.channelAddItem(conn, channelKey, item)
|
||||||
|
updatedChannels = append(updatedChannels, channelKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update all channels that have added items, because of the include matching
|
||||||
|
for _, value := range updatedChannels {
|
||||||
|
b.updateChannelUnreadCount(conn, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for the exclude regex
|
||||||
if setting, e := b.Settings[channel]; e {
|
if setting, e := b.Settings[channel]; e {
|
||||||
if setting.ExcludeRegex != "" {
|
if setting.ExcludeRegex != "" {
|
||||||
excludeRegex, err := regexp.Compile(setting.ExcludeRegex)
|
excludeRegex, err := regexp.Compile(setting.ExcludeRegex)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user