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:
@@ -102,18 +102,20 @@ func (f *Fetcher) Fetch(ctx context.Context) (Summary, error) {
|
||||
headersSeen[parsed.SourceHeader] = struct{}{}
|
||||
}
|
||||
msg := &store.Message{
|
||||
GmailID: gmailID(r, uidValidity),
|
||||
ThreadID: r.GmailThreadID,
|
||||
MessageIDHeader: parsed.MessageID,
|
||||
FromAddr: parsed.From,
|
||||
ToAddr: parsed.To,
|
||||
Subject: parsed.Subject,
|
||||
BodyText: parsed.BodyText,
|
||||
SourceAddress: parsed.SourceAddress,
|
||||
DateSent: parsed.Date,
|
||||
ReceivedAt: now,
|
||||
IMAPUID: int64(r.UID),
|
||||
IMAPUIDValidity: int64(uidValidity),
|
||||
GmailID: gmailID(r, uidValidity),
|
||||
ThreadID: r.GmailThreadID,
|
||||
MessageIDHeader: parsed.MessageID,
|
||||
FromAddr: parsed.From,
|
||||
ToAddr: parsed.To,
|
||||
Subject: parsed.Subject,
|
||||
BodyText: parsed.BodyText,
|
||||
SourceAddress: parsed.SourceAddress,
|
||||
ListUnsubscribe: parsed.ListUnsubscribe,
|
||||
ListUnsubscribePost: parsed.ListUnsubscribePost,
|
||||
DateSent: parsed.Date,
|
||||
ReceivedAt: now,
|
||||
IMAPUID: int64(r.UID),
|
||||
IMAPUIDValidity: int64(uidValidity),
|
||||
}
|
||||
if _, err := f.store.UpsertMessage(ctx, msg); err != nil {
|
||||
return sum, err
|
||||
|
||||
Reference in New Issue
Block a user