-
- Downloads
[FIX] mail: correct starred count computation in private channels
Current behavior Starred messages counter takes into account the starred messages of a private channels even if we no longer have access to this channel. Happens with deleted messages too. Steps channels - Install Discuss - Create a Private Channel and invite Marc Demo to join it then send him a message - *As Marc Demo*, star the message then leave the channel -> Starred counter still shows 1 Steps for deleted messages - Join the private channel again - Delete the starred message (with Mitchell Admin) -> Starred counter still shows 1 for Marc Demo Reasons Starred message count is computed by a raw sql [1] which only counts partner's occurrences without taking into account the message's state and/or the associated channel. Side records (stars, notifications) are not removed when emptying a message content [2]. With changes - It doesn't take into account messages from a private channel which we no longer have access to by doing a search on mail.message instead of doing it in SQL (which filters out invisible messages); - It correctly voids side records when emptying messages; Side effects This somehow raises number of queries because we now check access on messages and records. However this is necessary as bypassing ACLs means unreachable notifications or stars. OPW-2742092 Task-2813738 [1] : https://github.com/odoo/odoo/blob/2c1c6b1373c238216fda1e2d9d2f00b5d16c8ca3/addons/mail/models/res_partner.py#L49-L51 [2] : 776d1ee0 closes odoo/odoo#97974 X-original-commit: b1e8f7d97e3a1fa624436d2dd6801bf5fe7d19aa Related: odoo/enterprise#30415 Signed-off-by:Thibault Delavallee (tde) <tde@openerp.com>
Showing
- addons/mail/models/mail_message.py 20 additions, 0 deletionsaddons/mail/models/mail_message.py
- addons/mail/models/res_users.py 1 addition, 1 deletionaddons/mail/models/res_users.py
- addons/mail/tests/test_mail_channel.py 24 additions, 0 deletionsaddons/mail/tests/test_mail_channel.py
- addons/test_discuss_full/tests/test_performance.py 2 additions, 2 deletionsaddons/test_discuss_full/tests/test_performance.py
- addons/test_mail/tests/test_mail_message.py 71 additions, 2 deletionsaddons/test_mail/tests/test_mail_message.py
Loading
Please register or sign in to comment