[18.0][IMP] mail_tracking: Reactive tracking status in the chatter - #263
Open
CarlosRoca13 wants to merge 1 commit into
Open
[18.0][IMP] mail_tracking: Reactive tracking status in the chatter#263CarlosRoca13 wants to merge 1 commit into
CarlosRoca13 wants to merge 1 commit into
Conversation
The tracking status shown in the chatter only refreshed on a page reload. A mail.tracking.email state change happens outside of any user session and doesn't touch mail.notification, so core's _notify_message_notification_update() is never triggered for it and nothing is pushed to the bus. Notify the involved users on every state write instead. The store has to be built once per recipient because is_failed_message is computed for the reader, and the refresh is aggregated in cr.precommit so that a message with several recipients emits a single notification instead of one per email sent. Furthermore, MessageTracking captured props.partner_trackings in setup(), which isn't re-run when the props change. As tracking_status() returns a brand new list on every call, the component kept rendering the trackings the message had when it was created. Read them from the props on each render.
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.
The tracking status shown in the chatter only refreshed on a page reload.
A mail.tracking.email state change happens outside of any user session and doesn't touch mail.notification, so core's _notify_message_notification_update() is never triggered for it and nothing is pushed to the bus. Notify the involved users on every state write instead. The store has to be built once per recipient because is_failed_message is computed for the reader, and the refresh is aggregated in cr.precommit so that a message with several recipients emits a single notification instead of one per email sent.
Furthermore, MessageTracking captured props.partner_trackings in setup(), which isn't re-run when the props change. As tracking_status() returns a brand new list on every call, the component kept rendering the trackings the message had when it was created. Read them from the props on each render.
cc @Tecnativa
ping @christian-ramos-tecnativa @pedrobaeza