8000 feat(filters): create a filter from a message's context menu by fsoft72 · Pull Request #428 · hyprlab/hylki · GitHub
[go: up one dir, main page]

Skip to content

feat(filters): create a filter from a message's context menu - #428

Closed
fsoft72 wants to merge 1 commit into
hyprlab:mainfrom
fsoft72:feat/filter-from-message
Closed

fsoft72 wants to merge 1 commit into
hyprlab:mainfrom
fsoft72:feat/filter-from-message

Conversation

@fsoft72
@fsoft72 fsoft72 commented Oct 12, 2026 •
Copy link
Copy Markdown
Contributor

What

A Create a filter from this email entry in the message context menu, both in the message list and in the reader. It opens the filter editor on a new rule already filled in from the message:

  • the message's account;
  • From contains the sender's address;
  • Subject contains the subject, without any leading Re:, Fwd: or Fw: (repeated and in any case), so a whole thread matches;
  • both conditions have to match.

The user then picks the action (move to a folder, tag, ...) and saves. The rule is added as a new one and never overwrites an existing rule.

Why

Building a filter for "mail like this one" meant copying the sender and subject by hand into Settings → Filters. Starting from the message is quicker and avoids typos.

How

  • src/ui/message_row.rs: new RowAction::CreateFilter.
  • src/ui/message_list.rs, src/app.rs: the entry, with the filter-folder icon, sits next to Add Sender to Contacts in both menus.
  • src/config.rs: FilterRule::draft_from_message() builds the draft, and strip_reply_prefixes() cleans the subject. An empty subject adds no Subject condition.
  • src/ui/accounts.rs: new AccountsInput::AddFilterFrom(rule). open_filter_page() takes an optional prefill that fills the editor the same way editing does, but saves as a new rule.
  • src/app.rs: the action opens Settings on the Filters page and sends the draft to the accounts panel.
  • po/hylki.pot: the new string. CHANGELOG.md: one entry.

Testing

  • cargo test draft_filter: 3 passed (draft_filter_matches_sender_and_subject, draft_filter_strips_reply_and_forward_prefixes, draft_filter_skips_an_empty_subject).
  • By hand on X11: right-click a message in the list → the editor opens with sender and subject filled in. This needs the X11 context menu fix in fix(menus): open right-click menus on the button's release on X11 #427; without it no menu entry works on X11.
  • Not tried by hand: the reader's menu, and Wayland.

The message list's and the reader's context menus get "Create a filter
from this email". It opens the filter editor with the sender's address
and the subject, minus any leading Re:/Fwd:/Fw:, filled in as two
conditions that both have to match.
hyprlab added a commit that referenced this pull request Oct 12, 2026
Changes from the pull request: the entry reads "Create Filter from Message…", in title case like the menu's other entries.

Co-Authored-By: Fabio Rotondo <2844375+fsoft72@users.noreply.github.com>
@hyprlab hyprlab mentioned this pull request Oct 14, 2026
@hyprlab
hyprlab commented Oct 14, 2026
Copy link
Copy Markdown
Owner

Agentic reply:

Your feature is in the 1.44.0-beta.7 release (x86_64 only). The one change: the entry reads "Create Filter from Message…", in title case like the other entries in those menus. Please test it there and report anything that doesn't look right. It reaches the stable channel with the next stable release.

The beta build is in the repo now: flatpak update picks it up.

@hyprlab hyprlab closed this Oct 14, 2026
@hyprlab hyprlab mentioned this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0