Files
Evection/templates/rules/rule_list.html
T
ksmithandClaude Sonnet 5 5ed0499845 Add the filter/rules engine
Implements FilterRule (one condition -> action, scoped to a feed and/or
folder or global) with an evaluation engine applied at ingest time:
after the fetch pipeline commits new/updated articles, each affected
subscriber's enabled rules run in priority order against them, with
tag/star/mark_read actions stacking and hide short-circuiting further
evaluation for that article.

Adds rule management (create/edit/delete) and a "Re-apply" action that
re-evaluates a user's full ruleset against their unread backlog, scoped
by the triggering rule's own feed/folder — so a newly added rule can
retroactively affect already-ingested articles, not just future ones.

Verified live in-browser: created a "title contains 'Show HN' -> star"
rule scoped to the subscribed Hacker News feed, re-applied it against
the existing unread backlog, and confirmed both matching articles were
starred.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-30 16:31:33 -06:00

39 lines
1.6 KiB
HTML

{% extends "base.html" %}
{% block title %}Rules — Evection{% endblock %}
{% block content %}
<p><a href="{% url 'reader:stream' %}">&larr; Back to stream</a></p>
<h1>Filter rules</h1>
<p><a href="{% url 'rules:create_rule' %}">New rule</a></p>
<ul class="rule-list">
{% for rule in rules %}
<li class="rule-row{% if not rule.is_enabled %} is-disabled{% endif %}">
<div>
<strong>{{ rule.name|default:"(unnamed rule)" }}</strong>
<div class="rule-summary">
{{ rule.get_match_field_display }} {{ rule.get_match_type_display|lower }}
"{{ rule.match_value }}"
{% if rule.feed %} in {{ rule.feed.title }}{% endif %}
{% if rule.folder %} in folder {{ rule.folder.name }}{% endif %}
&rarr; {{ rule.get_action_display }}{% if rule.action == "tag" %} "{{ rule.action_value }}"{% endif %}
{% if not rule.is_enabled %} (disabled){% endif %}
</div>
</div>
<div class="rule-actions">
<a href="{% url 'rules:edit_rule' rule.pk %}" class="icon-btn">Edit</a>
<form method="post" action="{% url 'rules:reapply_rule' rule.pk %}" class="inline-form">
{% csrf_token %}
<button type="submit" class="icon-btn">Re-apply</button>
</form>
<form method="post" action="{% url 'rules:delete_rule' rule.pk %}" class="inline-form">
{% csrf_token %}
<button type="submit" class="icon-btn">Delete</button>
</form>
</div>
</li>
{% empty %}
<li class="empty-state">No rules yet.</li>
{% endfor %}
</ul>
{% endblock %}