[IMP] im_livechat : avoid double notif for public livechat channel and clean method
As in super, we add uuid and message if channel is public we have to exculde the public channel to add the same in a livechat case Also, _channel_message_notifications is a bit rewritten to remove useless code. Indeed, notifications will always be filled in as _channel_message_notifications is only called by _notify that ensure that self is not null and that message is singleton. In super, the notifications will then be filled in and in override, no need to check if notifications is not empty. We take the message dict from notif to avoid calling message_format a second time. Task ID : 1895998 Closes PR #28283
This commit is contained in:
@@ -48,11 +48,10 @@ class MailChannel(models.Model):
|
||||
should be added to the notification, since the user cannot be listining to the channel.
|
||||
"""
|
||||
notifications = super(MailChannel, self)._channel_message_notifications(message)
|
||||
message_values_dict = notifications[0][1] if len(notifications) else dict(message.message_format()[0])
|
||||
for channel in self:
|
||||
# add uuid for private livechat channels to allow anonymous to listen
|
||||
if channel.channel_type == 'livechat':
|
||||
notifications.append([channel.uuid, message_values_dict])
|
||||
if channel.channel_type == 'livechat' and channel.public == 'private':
|
||||
notifications.append([channel.uuid, notifications[0][1]])
|
||||
if not message.author_id:
|
||||
unpinned_channel_partner = self.mapped('channel_last_seen_partner_ids').filtered(lambda cp: not cp.is_pinned)
|
||||
if unpinned_channel_partner:
|
||||
|
||||
Reference in New Issue
Block a user