[bugfix] Hoist filterable text field extraction out of loop (#3297)
This doesn't change within the loop, so there's no point in repeating it.
This commit is contained in:
parent
4fa0d41202
commit
f3311d6273
|
@ -934,6 +934,14 @@ func (c *Converter) statusToAPIFilterResults(
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point, the status isn't muted, but might still be filtered.
|
// At this point, the status isn't muted, but might still be filtered.
|
||||||
|
if len(filters) == 0 {
|
||||||
|
// If it can't be filtered because there are no filters, we're done.
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract text fields from the status that we will match filters against.
|
||||||
|
fields := filterableTextFields(s)
|
||||||
|
|
||||||
// Record all matching warn filters and the reasons they matched.
|
// Record all matching warn filters and the reasons they matched.
|
||||||
filterResults := make([]apimodel.FilterResult, 0, len(filters))
|
filterResults := make([]apimodel.FilterResult, 0, len(filters))
|
||||||
for _, filter := range filters {
|
for _, filter := range filters {
|
||||||
|
@ -947,7 +955,6 @@ func (c *Converter) statusToAPIFilterResults(
|
||||||
|
|
||||||
// List all matching keywords.
|
// List all matching keywords.
|
||||||
keywordMatches := make([]string, 0, len(filter.Keywords))
|
keywordMatches := make([]string, 0, len(filter.Keywords))
|
||||||
fields := filterableTextFields(s)
|
|
||||||
for _, filterKeyword := range filter.Keywords {
|
for _, filterKeyword := range filter.Keywords {
|
||||||
var isMatch bool
|
var isMatch bool
|
||||||
for _, field := range fields {
|
for _, field := range fields {
|
||||||
|
|
Loading…
Reference in New Issue