Address message filter review findings

False positives
- Same-sender repeats need at least 3 words and 10 characters, so short
  replies ("ok", "test") repeated within 10 minutes stay visible.
- Repeated characters needs a run of 20+ of one non-digit character;
  "Noooooooo!", separators, a row of emoji and long numbers are chat.

Correctness
- Rules apply to stored messages: adding a rule hides matching messages
  already in the chat, and removing or disabling one shows again what only
  it was hiding. Other filter reasons are left alone. Also applied when
  history is loaded.
- The filter runs after mesh dedup, inside _addChannelMessage, so each
  message is evaluated and counted by the duplicate tracker once.
- Channels excluded from filtering no longer feed implicit clean examples
  to the classifier.
- Unread counting and the unread anchor treat filtered messages as normal
  when filtering is off for the channel.

Performance
- Classifier training runs in a background isolate (injectable trainer for
  widget tests); app start-up no longer waits for it.
- Reply previews look up the quoted message through an id index instead
  of scanning the channel per bubble.
- The latest-messages channel sort computes each channel's latest visible
  message once.

Cleanup
- Use MessageFilterText.isStructuredPayload instead of a screen copy.

Docs: message-filter.md explains how each check works, including the
learned classifier, and drops the outdated "new messages only" limit.
This commit is contained in:
zjs81 committed 2026-11-06 00:54:09 -07:00
1 parent 4862966e47
commit a9d369f42f
50 files changed
+703 -181

No files matched your search

+1 -1
View File
@@ -3564,7 +3564,7 @@
"messageFilter_duplicates": "重复消息",
"messageFilter_duplicatesSubtitle": "重复发送的相同消息,或多个发送者发送的相同消息",
"messageFilter_repeatedCharacters": "重复字符",
"messageFilter_repeatedCharactersSubtitle": "类似“aaaaaaaa”或“!!!!!!!!”的消息",
"messageFilter_repeatedCharactersSubtitle": "同一字符的长串重复,例如“aaaaaaaaaaaaaaaaaaaa”",
"messageFilter_learning": "从“垃圾消息”点击中学习",
"messageFilter_learningSubtitle": "{spam} 个垃圾消息示例和 {notSpam} 个非垃圾消息示例",
"@messageFilter_learningSubtitle": {