Repository navigation
bridge: keep a Telegram mute over the QQ group message mask - #20
Open
std-external wants to merge 1 commit into
Open
std-external wants to merge 1 commit into
std-external wants to merge 1 commit into
Conversation
std-external
force-pushed
the
fix/qq-mask-notify-override
branch
from
November 18, 2026 05:10
d353943 to
9c6b06d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
在 Telegram 客户端里对某个(经 CrossGram 桥接的)QQ 群点「Mute forever」之后没有效果:静音图标一会儿就没了,反复点也没用(crossgram 测试群反馈,报告人确认「多点很多下也不行」)。
原因
静音已经实现,请求也确实落库了:
account.updateNotifySettings→NotificationSettingsStore(mtproto_notification_settings表)→ 回包 + 推 update。问题在读路径:_effectiveNotifySettings()把 QQ 群消息设置映射成 Telegram 策略(QQ_GROUP_MSG_MASK_POLICIES:mask 1「接收并提醒」→muteUntil 0),并且无条件覆盖落库的 per-peer override:于是 QQ 侧是 mask 1 的群,客户端点静音 forever 之后:落库
0x7fffffff→ 反向写 QQ mask 4 → 如果这次写回失败(QQNT bridge 没有/conversations/:chatType/:peerUin/notification-mask路由、上游报错、或 QQ 侧没真正落地),内存里的 mask 还是 1;同一次请求的回包就走上面这段逻辑把muteUntil算成 0,之后每次account.getNotifySettings、每次 dialog 刷新(dialog.notifySettings)、每次打开会话(channels.getFullChannel)都是 0。因为策略每次读都重算,输入不变结果不变,所以点多少次都一样 —— 不是「首次请求被吞」。
修复
把 QQ 群消息设置降级为默认值,不再覆盖用户在 Telegram 里的显式选择(和 Telegram 自己「per-chat 覆盖分类默认」的语义一致):
_syncQqGroupMsgMask)保留,仍是 best-effort:它只影响 QQ 自己那边,不再决定 Telegram 侧读回什么。测试
packages/bridge/src/notification-mask-override.test.ts(5 个用例):notification-settings.e2e.test.ts里原本断言「QQ mask 覆盖显式静音」的用例(mask-notify 由 0 改为 forever;QQ 写回失败场景由 0 改为 forever),用例名改为mirrors QQ group message masks unless the user muted the chat in Telegram;顺手修了该文件里a2b09bc之后失效的合成 peer id(现在是peerTlSeed(sessionId, id),文件原本还在用stableId('peer:id'),整文件PEER_ID_INVALID跑不起来)。验证:
vitest run packages/bridge/src→ 860 passed / 1 failed;3 个测试文件起不来是环境问题(voice/voice-worker-client.test.ts需要本机cargo;scheduled-messages.test.ts、session-resolver.test.ts缺cron依赖,本机 node_modules 没装)。dialogs.test.ts+notification-settings.test.ts+notification-mask-override.test.ts+message-store.test.ts→ 121 passed。vitest run --config vitest.mtproto-e2e.config.mts packages/bridge/src/notification-settings.e2e.test.ts packages/bridge/src/dialog-folders.e2e.test.ts→ 18 passed。tsc -p tsconfig.test.json --noEmit→ 无错误。未包含
In-app browser关掉后重启又打开是另一处(packages/bridge/src/android-rpc.ts里account.getWebBrowserSettings是个不带openExternalBrowser位的硬编码空壳、account.updateWebBrowserSettings没实现,客户端每次启动都按账号设置重新拉)。那个留作后续单独处理。来源:crossgram 测试群里的反馈。