odoo/odoo#159362

Created by fw-bot
label
odoo-dev:master-17.0-fix-chat-deleted-message-counter-aku-cbmD-fw
head
d233f5b4d34e6e0d69d274af707900fca70644db
target
master
merged
1 month ago by Discuss, Alexandre Kühn (aku)
forward-port of
odoo/odoo#158943 DETACHED (conflicts: ('95fb0c21d3fe2bda63c32a508ccbd5026fc4d90b', 'Auto-merging addons/mail/static/src/core/common/thread_model.js\nAuto-merging addons/mail/static/src/core/common/thread_service.js\nCONFLICT (content): Merge conflict in addons/mail/static/src/core/common/thread_service.js\n', '17:52:29.985264 git.c:463 trace: built-in: git cherry-pick 95fb0c21d3fe2bda63c32a508ccbd5026fc4d90b\nerror: could not apply 95fb0c21d3fe... [FIX] mail: opening chat with deleted new message should mark as read\nhint: After resolving the conflicts, mark them with\nhint: "git add/rm <pathspec>", then run\nhint: "git cherry-pick --continue".\nhint: You can instead skip this commit with "git cherry-pick --skip".\nhint: To abort and get back to the state before "git cherry-pick",\nhint: run "git cherry-pick --abort".\n----------\nstatus:\n', ['95fb0c21d3fe2bda63c32a508ccbd5026fc4d90b']) ('95fb0c21d3fe2bda63c32a508ccbd5026fc4d90b', 'Auto-merging addons/mail/static/src/core/common/thread_model.js\nAuto-merging addons/mail/static/src/core/common/thread_service.js\nCONFLICT (content): Merge conflict in addons/mail/static/src/core/common/thread_service.js\n', '17:52:29.985264 git.c:463 trace: built-in: git cherry-pick 95fb0c21d3fe2bda63c32a508ccbd5026fc4d90b\nerror: could not apply 95fb0c21d3fe... [FIX] mail: opening chat with deleted new message should mark as read\nhint: After resolving the conflicts, mark them with\nhint: "git add/rm <pathspec>", then run\nhint: "git cherry-pick --continue".\nhint: You can instead skip this commit with "git cherry-pick --skip".\nhint: To abort and get back to the state before "git cherry-pick",\nhint: run "git cherry-pick --abort".\n----------\nstatus:\n', ['95fb0c21d3fe2bda63c32a508ccbd5026fc4d90b']))

[FW][FIX] mail: opening chat with deleted new message should mark as read

Before this commit, when a user of in chat posted a message and deleted it, all other users kept the chat as unread.

Steps to reproduce:
- Connect as Admin and March Demo
- Send a message to Admin as Demo in DM chat
- Demo deletes this message
- Marc opens the chat => the unread counter is 1 and cannot be removed

This happens because when a message is deleted, there's still a trace of it but the message is empty. However, empty messages could not be candidate of setting the last message being seing by a member, thus members were unable to mark the chat as read until someone else posted a newer message (and did not delete it).

This commit fixes the issue by taking empty messages into account for setting last message message of member, which allow to mark thread as read even when newer messages have been deleted.

opw-3764410

Forward-Port-Of: odoo/odoo#159192
Forward-Port-Of: odoo/odoo#158943