filter test dialog improvements:

- properly return results for filter rules matching specific feeds or
   categories
 - fix test results never returned for Uncategorized
 - show tooltip with specific word match and matched rule on resulting
   item hover
This commit is contained in:
Andrew Dolgov
2025-03-27 22:10:16 +03:00
parent c1e6a5ff63
commit 49766ab01f
2 changed files with 34 additions and 5 deletions

View File

@@ -19,6 +19,9 @@ const Filters = {
ACTION_REMOVE_TAG: 10,
PARAM_ACTIONS: [4, 6, 7, 9, 10],
filter_info: {},
formatMatchedRules: function(rules) {
return rules.map((r) => r.regexp_matches[0] + ' - ' + r.reg_exp).join('\n');
},
test: function() {
const test_dialog = new fox.SingleUseDialog({
title: "Test Filter",
@@ -43,8 +46,8 @@ const Filters = {
.replace("%f", test_dialog.results)
.replace("%d", offset);
results_list.innerHTML += result.items.reduce((current, item) => current + `<li><span class='title'>${item.title}</span><br>
<span class='feed'>${item.feed_title}</span>, <span class='date'>${item.date}</span>
results_list.innerHTML += result.items.reduce((current, item) => current + `<li title="${App.escapeHtml(dialog.formatMatchedRules(item.matched_rules))}"><span class='title'>${item.title}</span>
&mdash; <span class='feed'>${item.feed_title}</span>, <span class='date'>${item.date}</span>
<div class='preview text-muted'>${item.content_preview}</div></li>`, '');
// get the next batch if there may be more available and testing limits haven't been reached