mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Allow filtering feeds on entry.Author
This commit is contained in:
parent
3be0d14d44
commit
4a50ca9122
2 changed files with 6 additions and 2 deletions
|
@ -123,7 +123,7 @@ func isBlockedEntry(feed *model.Feed, entry *model.Entry) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if matchField(feed.BlocklistRules, entry.URL) || matchField(feed.BlocklistRules, entry.Title) || containsBlockedTag {
|
if matchField(feed.BlocklistRules, entry.URL) || matchField(feed.BlocklistRules, entry.Title) || matchField(feed.BlocklistRules, entry.Author) || containsBlockedTag {
|
||||||
slog.Debug("Blocking entry based on rule",
|
slog.Debug("Blocking entry based on rule",
|
||||||
slog.Int64("entry_id", entry.ID),
|
slog.Int64("entry_id", entry.ID),
|
||||||
slog.String("entry_url", entry.URL),
|
slog.String("entry_url", entry.URL),
|
||||||
|
@ -148,7 +148,7 @@ func isAllowedEntry(feed *model.Feed, entry *model.Entry) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if matchField(feed.KeeplistRules, entry.URL) || matchField(feed.KeeplistRules, entry.Title) || containsAllowedTag {
|
if matchField(feed.KeeplistRules, entry.URL) || matchField(feed.KeeplistRules, entry.Title) || matchField(feed.KeeplistRules, entry.Author) || containsAllowedTag {
|
||||||
slog.Debug("Allow entry based on rule",
|
slog.Debug("Allow entry based on rule",
|
||||||
slog.Int64("entry_id", entry.ID),
|
slog.Int64("entry_id", entry.ID),
|
||||||
slog.String("entry_url", entry.URL),
|
slog.String("entry_url", entry.URL),
|
||||||
|
|
|
@ -24,6 +24,8 @@ func TestBlockingEntries(t *testing.T) {
|
||||||
{&model.Feed{ID: 1, BlocklistRules: "(?i)example"}, &model.Entry{Title: "Example", Tags: []string{"example", "something else"}}, true},
|
{&model.Feed{ID: 1, BlocklistRules: "(?i)example"}, &model.Entry{Title: "Example", Tags: []string{"example", "something else"}}, true},
|
||||||
{&model.Feed{ID: 1, BlocklistRules: "(?i)example"}, &model.Entry{Title: "Example", Tags: []string{"something different", "something else"}}, true},
|
{&model.Feed{ID: 1, BlocklistRules: "(?i)example"}, &model.Entry{Title: "Example", Tags: []string{"something different", "something else"}}, true},
|
||||||
{&model.Feed{ID: 1, BlocklistRules: "(?i)example"}, &model.Entry{Title: "Something different", Tags: []string{"something different", "something else"}}, false},
|
{&model.Feed{ID: 1, BlocklistRules: "(?i)example"}, &model.Entry{Title: "Something different", Tags: []string{"something different", "something else"}}, false},
|
||||||
|
{&model.Feed{ID: 1, BlocklistRules: "(?i)example"}, &model.Entry{Title: "Something different", Author: "Example"}, true},
|
||||||
|
{&model.Feed{ID: 1, BlocklistRules: "(?i)example"}, &model.Entry{Title: "Something different", Author: "Something different"}, false},
|
||||||
{&model.Feed{ID: 1}, &model.Entry{Title: "No rule defined"}, false},
|
{&model.Feed{ID: 1}, &model.Entry{Title: "No rule defined"}, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +52,8 @@ func TestAllowEntries(t *testing.T) {
|
||||||
{&model.Feed{ID: 1, KeeplistRules: "(?i)example"}, &model.Entry{Title: "Example", Tags: []string{"example", "something else"}}, true},
|
{&model.Feed{ID: 1, KeeplistRules: "(?i)example"}, &model.Entry{Title: "Example", Tags: []string{"example", "something else"}}, true},
|
||||||
{&model.Feed{ID: 1, KeeplistRules: "(?i)example"}, &model.Entry{Title: "Example", Tags: []string{"something different", "something else"}}, true},
|
{&model.Feed{ID: 1, KeeplistRules: "(?i)example"}, &model.Entry{Title: "Example", Tags: []string{"something different", "something else"}}, true},
|
||||||
{&model.Feed{ID: 1, KeeplistRules: "(?i)example"}, &model.Entry{Title: "Something more", Tags: []string{"something different", "something else"}}, false},
|
{&model.Feed{ID: 1, KeeplistRules: "(?i)example"}, &model.Entry{Title: "Something more", Tags: []string{"something different", "something else"}}, false},
|
||||||
|
{&model.Feed{ID: 1, KeeplistRules: "(?i)example"}, &model.Entry{Title: "Something different", Author: "Example"}, true},
|
||||||
|
{&model.Feed{ID: 1, KeeplistRules: "(?i)example"}, &model.Entry{Title: "Something different", Author: "Something different"}, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range scenarios {
|
for _, tc := range scenarios {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue