Remove mention code

Should be readded more generally, so we can add posts mentioning some
regex to a channel
This commit is contained in:
Peter Stuifzand 2018-05-16 17:30:59 +02:00
parent b177dfd82e
commit a43c987a9a

View File

@ -29,7 +29,6 @@ import (
"log"
"net/http"
"net/url"
"regexp"
"rss"
"strings"
"time"
@ -325,8 +324,6 @@ func (b *memoryBackend) feedItems(fetchURL, contentType string, body io.Reader)
return items, nil
}
var nameRegex *regexp.Regexp = regexp.MustCompile(`(?i:pstuifzand|peter|stuifzand|peter\s*stuifzand|p83\.nl|publog\.stuifzandapp\.com)`)
func (b *memoryBackend) ProcessContent(channel, fetchURL, contentType string, body io.Reader) error {
items, err := b.feedItems(fetchURL, contentType, body)
if err != nil {
@ -336,11 +333,6 @@ func (b *memoryBackend) ProcessContent(channel, fetchURL, contentType string, bo
for _, item := range items {
item.Read = false
b.channelAddItem(channel, item)
// Add items to notifications that match my name and websites
if item.Content != nil && (len(item.Content.Text) > 0 && nameRegex.MatchString(item.Content.Text) || item.Content != nil && len(item.Content.HTML) > 0 && nameRegex.MatchString(item.Content.HTML)) {
b.channelAddItem("mentions", item)
}
}
return nil