diff --git a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_1.xml b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_1.xml index 66e76983449..27cb22b4b6a 100644 --- a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_1.xml +++ b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_1.xml @@ -6,7 +6,7 @@ Visitor #234, Mitchell Admin - Visitor #234, Mitchell Admin + Visitor #234 diff --git a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_10.xml b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_10.xml index 5fe63ec605e..dfef178eacf 100644 --- a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_10.xml +++ b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_10.xml @@ -7,6 +7,7 @@ livechat + Visitor diff --git a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_11.xml b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_11.xml index b1e45057de9..7f44b993531 100644 --- a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_11.xml +++ b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_11.xml @@ -7,6 +7,7 @@ livechat + Visitor diff --git a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_2.xml b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_2.xml index ae9b8773ee8..5460c1869fc 100644 --- a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_2.xml +++ b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_2.xml @@ -6,7 +6,7 @@ Visitor #323, Marc Demo - Visitor #323, Marc Demo + Visitor #323 diff --git a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_3.xml b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_3.xml index 0af655c96f2..fcf5091575b 100644 --- a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_3.xml +++ b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_3.xml @@ -6,7 +6,7 @@ Joel Willis, Mitchell Admin - Joel Willis, Mitchell Admin + Joel Willis diff --git a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_4.xml b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_4.xml index 9540e31ef94..57bd3c13c21 100644 --- a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_4.xml +++ b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_4.xml @@ -6,7 +6,7 @@ Joel Willis, Marc Demo - Joel Willis, Marc Demo + Joel Willis diff --git a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_5.xml b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_5.xml index 087ef6f60f8..83f10e5f751 100644 --- a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_5.xml +++ b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_5.xml @@ -6,7 +6,7 @@ Visitor #532, Mitchell Admin - Visitor #532, Mitchell Admin + Visitor #532 diff --git a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_6.xml b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_6.xml index 799afb253c0..382892d8866 100644 --- a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_6.xml +++ b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_6.xml @@ -6,7 +6,7 @@ Visitor #649, Mitchell Admin - Visitor #649, Mitchell Admin + Visitor #649 diff --git a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_7.xml b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_7.xml index 3f9869e8c82..f01ecfaa37f 100644 --- a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_7.xml +++ b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_7.xml @@ -6,7 +6,7 @@ Joel Willis, Mitchell Admin - Joel Willis, Mitchell Admin + Joel Willis diff --git a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_8.xml b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_8.xml index cf8a7eb124d..9246d371a44 100644 --- a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_8.xml +++ b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_8.xml @@ -6,7 +6,7 @@ Visitor #722, Marc Demo - Visitor #722, Marc Demo + Visitor #722 diff --git a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_9.xml b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_9.xml index 24a2f1a2bb4..498d338041f 100644 --- a/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_9.xml +++ b/addons/im_livechat/demo/im_livechat_channel/im_livechat_session_9.xml @@ -7,6 +7,7 @@ livechat + Visitor diff --git a/addons/im_livechat/static/src/core/thread_model_patch.js b/addons/im_livechat/static/src/core/thread_model_patch.js index d6522b26f2a..ea5ae517fc3 100644 --- a/addons/im_livechat/static/src/core/thread_model_patch.js +++ b/addons/im_livechat/static/src/core/thread_model_patch.js @@ -36,8 +36,8 @@ patch(Thread.prototype, "im_livechat", { if (!this.correspondent.is_public && this.correspondent.country) { return `${this.getMemberName(this.correspondent)} (${this.correspondent.country.name})`; } - if (this.anonymous_country) { - return `${this.getMemberName(this.correspondent)} (${this.anonymous_country.name})`; + if (this.channel?.anonymous_country) { + return `${this.getMemberName(this.correspondent)} (${this.channel.anonymous_country.name})`; } return this.getMemberName(this.correspondent); }, diff --git a/addons/mail/models/discuss/discuss_channel.py b/addons/mail/models/discuss/discuss_channel.py index 81e153b2a59..23854c26aab 100644 --- a/addons/mail/models/discuss/discuss_channel.py +++ b/addons/mail/models/discuss/discuss_channel.py @@ -237,9 +237,11 @@ class Channel(models.Model): raise ValidationError(_('Invalid value when creating a channel with memberships, only 0 is allowed.')) membership_pids = [cmd[2]['partner_id'] for cmd in membership_ids_cmd if cmd[0] == 0] + partner_ids_to_add = partner_ids # always add current user to new channel to have right values for # is_pinned + ensure they have rights to see channel - partner_ids_to_add = list(set(partner_ids + [self.env.user.partner_id.id])) + if not self.env.context.get('install_mode'): + partner_ids_to_add = list(set(partner_ids + [self.env.user.partner_id.id])) vals['channel_member_ids'] = membership_ids_cmd + [ (0, 0, {'partner_id': pid}) for pid in partner_ids_to_add if pid not in membership_pids diff --git a/addons/mail/static/src/core/common/thread_service.js b/addons/mail/static/src/core/common/thread_service.js index 45f4676c56d..dc084c533a7 100644 --- a/addons/mail/static/src/core/common/thread_service.js +++ b/addons/mail/static/src/core/common/thread_service.js @@ -10,7 +10,7 @@ import { replaceArrayWithCompare, } from "@mail/utils/common/arrays"; import { prettifyMessageContent } from "@mail/utils/common/format"; -import { assignDefined, createLocalId, onChange } from "@mail/utils/common/misc"; +import { assignDefined, createLocalId, onChange, nullifyClearCommands } from "@mail/utils/common/misc"; import { markup } from "@odoo/owl"; @@ -692,6 +692,7 @@ export class ThreadService { } thread.lastServerMessageId = serverData.last_message_id ?? thread.lastServerMessageId; if (thread.model === "discuss.channel" && serverData.channel) { + nullifyClearCommands(serverData.channel); thread.channel = assignDefined(thread.channel ?? {}, serverData.channel); } diff --git a/addons/test_discuss_full/tests/test_performance.py b/addons/test_discuss_full/tests/test_performance.py index 349e1bd7a18..5edb37720ef 100644 --- a/addons/test_discuss_full/tests/test_performance.py +++ b/addons/test_discuss_full/tests/test_performance.py @@ -142,7 +142,7 @@ class TestDiscussFullPerformance(TransactionCase): }], key=lambda member_data: member_data['id']))], 'custom_channel_name': False, 'id': self.channel_general.id, - 'memberCount': len(self.group_user.users | self.user_root), + 'memberCount': len(self.group_user.users), 'message_unread_counter': 5, }, 'create_uid': self.user_root.id,