[Bug][iOS] 正则「整条隐藏」的消息仍产生未读红点/计数(应在收到时直接忽略)

Open
#71 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
ios, swift
Domain
mobile

Research direction

Start with ChatHistoryEntriesForView.swift, ChatListNodeEntries.swift, and ApplicationContext.swift, then review the linked history commit to trace how filtered messages affect unread counts and badges. Reproduce with only hidden messages and with a mix of hidden and visible unread messages. Done means hidden messages add no unread indicators while visible messages still count consistently across the chat list, folders, and app badge.

Written by the indexing model from the issue text.

Description

问题描述

在 Nagram iOS 中启用「正则消息过滤」,将匹配规则设为「整条隐藏」后,消息确实不会显示在聊天内容中,但这些本来就不想看的消息仍然产生未读提示,群聊在聊天列表里继续显示红色未读红点/计数。

这不只是“进入群聊后无法清除未读”的问题。更核心的问题是:既然用户主动设置规则来忽略某类消息,就不应为了清除这些消息的未读提示而被迫打开群聊,更不应该打开群聊后发现什么也看不到、还要手动标记已读。

本 Issue 所说的红点首先是 Nagram 聊天列表中群聊右侧的未读角标/数字,不是单指 iOS 主屏幕 App 图标的角标。

复现步骤

  1. 在 Nagram 设置 → 消息 → 正则消息过滤中启用过滤功能。
  2. 创建并启用一条匹配群聊消息的正则规则,处理方式选择「整条隐藏」。
  3. 在没有其他未读消息干扰的情况下,让该群聊收到一条命中规则的新消息。
  4. 观察:消息本身已被隐藏,但聊天列表仍出现未读红点/数字。
  5. 进入该群聊,看不到被隐藏的消息;返回列表后红点仍在。
  6. 只有长按该群聊并选择「标记为已读」,未读提示才会消失。

实际行为

  • 匹配规则的消息被隐藏,不显示在聊天界面。
  • 仅由被隐藏消息产生的未读提示依然存在,需要用户处理。
  • 打开群聊也无法正常清除这部分提示,只能手动「标记为已读」。

预期行为(主要诉求)

「整条隐藏」应真正忽略匹配消息的未读提示,而不是仅仅隐藏消息气泡:

  • 如果新收到的消息全部命中整条隐藏规则,该群聊从一开始就不应出现未读红点/数字,用户无需进入群聊、更无需手动标记已读。
  • 如果聊天里同时有被隐藏消息和未被过滤的正常消息,未读计数及提醒应该只反映正常可见的未读消息;过滤规则不能吞掉真实需要阅读的内容。
  • 聊天列表、文件夹未读数及客户端角标等与未读消息有关的显示应尽可能保持一致(不必通过进入聊天来触发修正)。
  • 既有消息存储与 Telegram 的底层已读语义如何实现可由开发者选择;重点是过滤命中的消息不再制造需要用户处理的未读提示。

“进入群聊后能够清除红点”最多只是次要的兜底修复,不能替代以上行为。

环境

  • 平台:iOS
  • 客户端:Nagram iOS
  • 版本:2026-10-19 时的最新 TestFlight 版本(具体 build number 未提供)

可能相关的代码(排查线索)

  • submodules/TelegramUI/Sources/ChatHistoryEntriesForView.swift:case .hidden: continue 只影响聊天历史展示;源码注释说明不写回 Postbox。
  • submodules/ChatListUI/Sources/Node/ChatListNodeEntries.swift:nagramShouldIgnoreRegexFilteredUnreadBadge 根据当前已知的消息与未读总数来决定是否隐藏角标,可能遗漏一些情形。
  • submodules/TelegramUI/Sources/ApplicationContext.swift:已有针对过滤消息扣减 App 角标的逻辑。
  • 相关历史提交:fix: apply message filters to notifications and badges。

以上仅为排查线索,并未确认最终根因。

Dominant language
Swift
Stars
151
Forks
22
Avg merge
1d 10h
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NextAlone/Nagram-iOS

All issues in NextAlone/Nagram-iOS

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.