mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-07 06:37:44 +02:00
stop sending matched content twice for the tooltip, use smaller objects containing only regular expression and rule type
This commit is contained in:
parent
10c488e1d0
commit
b4962b670d
@ -171,6 +171,7 @@ class Pref_Filters extends Handler_Protected {
|
|||||||
$content_preview = "";
|
$content_preview = "";
|
||||||
|
|
||||||
$matches = [];
|
$matches = [];
|
||||||
|
$rules = [];
|
||||||
|
|
||||||
$entry_title = $entry["title"];
|
$entry_title = $entry["title"];
|
||||||
|
|
||||||
@ -184,6 +185,11 @@ class Pref_Filters extends Handler_Protected {
|
|||||||
|
|
||||||
$matches[] = $rule_regexp_match;
|
$matches[] = $rule_regexp_match;
|
||||||
|
|
||||||
|
$rules[] = [
|
||||||
|
'reg_exp' => $rule['reg_exp'],
|
||||||
|
'type' => $rule['type']
|
||||||
|
];
|
||||||
|
|
||||||
if (in_array($rule['type'], ['content', 'both'])) {
|
if (in_array($rule['type'], ['content', 'both'])) {
|
||||||
// also stripping [\r\n\t] to match what's done for content in RSSUtils#get_article_filters()
|
// also stripping [\r\n\t] to match what's done for content in RSSUtils#get_article_filters()
|
||||||
$entry_content_text = strip_tags(preg_replace("/[\r\n\t]/", "", $entry["content"]));
|
$entry_content_text = strip_tags(preg_replace("/[\r\n\t]/", "", $entry["content"]));
|
||||||
@ -232,7 +238,7 @@ class Pref_Filters extends Handler_Protected {
|
|||||||
'feed_title' => $entry['feed_title'],
|
'feed_title' => $entry['feed_title'],
|
||||||
'date' => mb_substr($entry['date_entered'], 0, 16),
|
'date' => mb_substr($entry['date_entered'], 0, 16),
|
||||||
'content_preview' => $content_preview,
|
'content_preview' => $content_preview,
|
||||||
'matched_rules' => $matched_rules, // TODO shorten object passed to frontend
|
'rules' => $rules
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ const Filters = {
|
|||||||
PARAM_ACTIONS: [4, 6, 7, 9, 10],
|
PARAM_ACTIONS: [4, 6, 7, 9, 10],
|
||||||
filter_info: {},
|
filter_info: {},
|
||||||
formatMatchedRules: function(rules) {
|
formatMatchedRules: function(rules) {
|
||||||
return rules.map((r) => r.regexp_matches[0] + ' - ' + r.reg_exp + ' (' + r.type + ')').join('\n');
|
return rules.map((r) => r.reg_exp + ' (' + r.type + ')').join('\n');
|
||||||
},
|
},
|
||||||
test: function() {
|
test: function() {
|
||||||
const test_dialog = new fox.SingleUseDialog({
|
const test_dialog = new fox.SingleUseDialog({
|
||||||
@ -46,7 +46,7 @@ const Filters = {
|
|||||||
.replace("%f", test_dialog.results)
|
.replace("%f", test_dialog.results)
|
||||||
.replace("%d", offset);
|
.replace("%d", offset);
|
||||||
|
|
||||||
results_list.innerHTML += result.items.reduce((current, item) => current + `<li title="${App.escapeHtml(dialog.formatMatchedRules(item.matched_rules))}"><span class='title'>${item.title}</span>
|
results_list.innerHTML += result.items.reduce((current, item) => current + `<li title="${App.escapeHtml(dialog.formatMatchedRules(item.rules))}"><span class='title'>${item.title}</span>
|
||||||
— <span class='feed'>${item.feed_title}</span>, <span class='date'>${item.date}</span>
|
— <span class='feed'>${item.feed_title}</span>, <span class='date'>${item.date}</span>
|
||||||
<div class='preview text-muted'>${item.content_preview}</div></li>`, '');
|
<div class='preview text-muted'>${item.content_preview}</div></li>`, '');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user