Skip to content

Add Text Rules for incoming messages - #485

Merged
Avi0n merged 14 commits into
devfrom
feature/text-rules
Nov 6, 2026
Merged

Avi0n merged 14 commits into
devfrom
feature/text-rules

Conversation

@Avi0n

@Avi0n Avi0n commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Description

People receiving repeated spam had to block individual senders. Text Rules lets them filter an incoming message by its text or sender name and choose which channel, DM, or room conversations the rules apply to. Related to #483.

Overview of Changes

  • Add Text Rules and Recently Blocked under Settings → Chats → Blocking, with per-conversation overrides in conversation info.
  • Filter new arrivals before they can appear in the conversation, change unread counts, or send a notification. Keep matched messages in Recently Blocked so users can see what was filtered and why.
  • Use the same Radio ID and slot attribution as ordinary channel delivery on stock firmware. If a slot cannot be resolved, the message follows ordinary delivery.
  • Retry room recovery after a definitive radio rejection. Keep radio cleanup retryable after reset, and resume queued delivery if the user cancels an ordinary erase.

Testing

Try it with demo data. In Settings → Chats → Blocking → Text Rules, add a message rule that contains demo spam. Enable it for one channel and leave another channel off. Send the same text to both. The enabled channel's message should appear only in Recently Blocked with the matching phrase underlined. The other message should appear in its conversation. Repeat with a message queued while disconnected.

Regression evidence

Input Observed result
Identical stock channel frames on two slots with opposite overrides The enabled channel's message went to Recently Blocked and the other was delivered, in both live and catch-up tests.
Stock radio rejects the initial room rewind with ERR_CODE_TABLE_FULL Before the fix, the missing post was not recovered. After the fix, the next scheduled request retried the bookmark and recovered the post.
Pairing removal is canceled after factory reset Before the fix, the pending cleanup record disappeared. After the fix, it stayed retryable and retry sent no second reset.
Channel Info opens offline for a channel without a Text Rules identity The simulator test confirmed that the first open initializes the identity and reopening preserves the override.

Details

Rules, conversation overrides, and Recently Blocked entries are stored locally. Recently Blocked entries are excluded from shareable backups. Channel slot reuse follows existing stock delivery behavior.

ELI5

Choose the words or sender names you want to filter and where the rules apply. Matching messages go to a separate list you can check later.

Avi0n added 8 commits November 4, 2026 09:49
- Filter channel, DM, and room messages using local rules.
- Keep matches in Recently Blocked for review.
- Handle missed room posts and interrupted radio cleanup.
# Conflicts:
#	MC1/State/MessageEventDispatcher.swift
#	MC1/Views/RemoteNodes/Rooms/RoomConversationView.swift
#	MC1/Views/Settings/Sections/DangerZoneViewModel.swift
#	MC1/Views/Settings/SettingsSubpage.swift
#	MC1Services/Sources/MC1Services/Connection/ConnectionManager+Lifecycle.swift
#	MC1Services/Sources/MC1Services/Connection/ConnectionManager+Pairing.swift
#	MC1Services/Sources/MC1Services/Connection/ConnectionManager.swift
#	MC1Services/Sources/MC1Services/ServiceContainer.swift
#	MC1Services/Sources/MC1Services/Services/AdvertisementService.swift
#	MC1Services/Sources/MC1Services/Services/MessagePollingService.swift
#	MC1Services/Sources/MC1Services/Services/PersistenceStore+Devices.swift
#	MC1Services/Sources/MC1Services/Services/PersistenceStore.swift
#	MC1Services/Sources/MC1Services/Services/RemoteNodeService+Login.swift
#	MC1Services/Sources/MC1Services/Services/RoomServerService.swift
#	MC1Services/Sources/MC1Services/Services/RxLogService.swift
#	MC1Services/Sources/MC1Services/Sync/SyncCoordinator+MessageHandlers.swift
#	MC1Services/Tests/MC1ServicesTests/ConnectionManagerPairingTests.swift
#	MC1Services/Tests/MC1ServicesTests/Mocks/MockAccessorySetupKitService.swift
- Require a receive scope through delivery so each layer can reject stale work.
- Save rules directly and update DTO copies to avoid rebuilding records.
- Verify that Text Rules settings stay out of backups and remove duplicate test cases.
# Conflicts:
#	MC1Services/Tests/MC1ServicesTests/Helpers/ConnectionRadioHandoffHarness.swift
A space after the last word was stored with the phrase and then failed to match.
- Name the message, rule, sender, chat, node, and time on each hidden message.
- Describe the matched rule with the summary the rules list already uses.
- Translate the new labels for the other locales.
@Avi0n
Avi0n marked this pull request as ready for review November 6, 2026 04:17
@Avi0n
Avi0n merged commit 2b66930 into dev Nov 6, 2026
4 checks passed
@Avi0n
Avi0n deleted the feature/text-rules branch November 6, 2026 17:52
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.

1 participant