feat: server-push mex notification dispatch (reachout timelock + message capping)#2445
Open
feat: server-push mex notification dispatch (reachout timelock + message capping)#2445
Conversation
Contributor
|
Thanks for opening this pull request and contributing to the project! The next step is for the maintainers to review your changes. If everything looks good, it will be approved and merged into the main branch. In the meantime, anyone in the community is encouraged to test this pull request and provide feedback. ✅ How to confirm it worksIf you’ve tested this PR, please comment below with: This helps us speed up the review and merge process. 📦 To test this PR locally:If you encounter any issues or have feedback, feel free to comment as well. |
7884e72 to
36dc13a
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.
Context
Follow-up to #2442 and the investigation in #2441.
The current
handleMexNewsletterNotificationonly handles newsletter operations and assumes all mex notifications use a{ operation, updates }JSON structure. In reality, WA Web routes 27+ operation types through a dispatcher that reads<update op_name="...">from the binary node and parses a standard GQL response body ({ data, errors }). This means non-newsletter mex notifications (reachout timelock, message capping, LID changes, etc.) are silently dropped today.What this PR does
Refactors the mex notification handler into a proper
op_name-based dispatcher matching WA Web'sWAWebHandleMexNotification.js, and adds two new handlers:Reachout timelock (
NotificationUserReachoutTimelockUpdate) — server-pushed account restriction updates, emitted viaconnection.updatewithreachoutTimeLock. Handles both restriction set (with* 1000timestamp conversion + 60s default) and restriction lifted, matchingWAWebMexReachoutTimelockNotificationHandler.js.Message capping (
MessageCappingInfoNotification) — server-pushed sending quota changes for business accounts, emitted via a newmessage-capping.updateevent. MatchesWAWebNewChatMessageCappingNotificationHandler.js.Existing newsletter notifications keep working via a legacy fallback path — no breaking changes.
Usage
Files changed
src/Socket/messages-recv.ts— new dispatcher + handlers, legacy newsletter fallbacksrc/Types/State.ts—ReachoutTimelockState, enforcement type enum, capping typessrc/Types/Events.ts—message-capping.updateevent