Phase 6: rules editor + unsubscribe detection (AUD-72)
- FR-11 rules editor: plain-text area at /rules, saved and versioned (SaveRules appends a version; restore re-saves an old version), parse errors surfaced, one-click re-classify. The reply model now reads the rules document too (FR-11). - FR-7 unsubscribe: parse and store List-Unsubscribe / List-Unsubscribe-Post (migration v6), detect email and web links (internal/unsubscribe), a domain-level ignore list, and an explicit record of what was marked. No code path contacts an unsubscribe link; acting on one needs Sam's approval. - Migration v6 is additive; unsubscribe gains url/updated_at. - Tests: detector, parser, store migration/records/candidates, rules editor, unsubscribe handlers, message-detail rendering. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -21,6 +21,10 @@ CREATE TABLE IF NOT EXISTS messages (
|
||||
-- Phase 5 (FR-8): the RFC822 Message-ID header. A reply sets In-Reply-To and
|
||||
-- References to it so Gmail files the reply in the same thread.
|
||||
message_id_header TEXT,
|
||||
-- Phase 6 (FR-7): the raw RFC 2369/8058 unsubscribe headers, stored so the
|
||||
-- detector can run without a refetch.
|
||||
list_unsubscribe TEXT,
|
||||
list_unsubscribe_post TEXT,
|
||||
from_addr TEXT,
|
||||
to_addr TEXT,
|
||||
subject TEXT,
|
||||
@@ -94,11 +98,16 @@ CREATE TABLE IF NOT EXISTS actions_log (
|
||||
CREATE INDEX IF NOT EXISTS idx_actions_log_message ON actions_log (message_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_actions_log_created ON actions_log (created_at);
|
||||
|
||||
-- FR-7: unsubscribe tracker and ignore list.
|
||||
-- FR-7: unsubscribe tracker and ignore list. `status` is 'ignored' for a domain
|
||||
-- on the ignore list, or 'done' for a domain Sam has recorded as unsubscribed.
|
||||
-- The app never follows a link itself: it only marks and records (AUD-72).
|
||||
CREATE TABLE IF NOT EXISTS unsubscribe (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
domain TEXT NOT NULL UNIQUE,
|
||||
status TEXT NOT NULL DEFAULT 'done' CHECK (status IN ('done', 'ignored')),
|
||||
-- url records the link that was detected or marked (Phase 6).
|
||||
url TEXT NOT NULL DEFAULT '',
|
||||
updated_at TEXT,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user