[FIX] mail: don't reset subscriptions before adding one
When posting on a thread the user can be auto-subscribed to its default
types. But if the user has previously been subscribed to other subtypes,
those are lost.
With this commit, user mentionned (@{username} in message) or added as
follower for default subtypes are not subscribed if they were already
followers of the record.
So if default subtype is "Comment" and user was only following subtype
"Alarma!" (by checking it and then un-checking "Comment"), then if the
user comment:
-> before this commit, the user would then follow subtype "Comment" and
not follow anymore "Alarma!"
-> after this commit, the user would follow the subtype "Alarma!"
closes #12008
opw-669127
opw-673766
This commit is contained in:
@@ -1691,7 +1691,7 @@ class MailThread(models.AbstractModel):
|
||||
partner_to_subscribe = partner_ids
|
||||
if self._context.get('mail_post_autofollow_partner_ids'):
|
||||
partner_to_subscribe = filter(lambda item: item in self._context.get('mail_post_autofollow_partner_ids'), partner_ids)
|
||||
self.message_subscribe(list(partner_to_subscribe))
|
||||
self.message_subscribe(list(partner_to_subscribe), force=False)
|
||||
|
||||
# _mail_flat_thread: automatically set free messages to the first posted message
|
||||
MailMessage = self.env['mail.message']
|
||||
@@ -1743,7 +1743,7 @@ class MailThread(models.AbstractModel):
|
||||
# done with SUPERUSER_ID, because on some models users can post only with read access, not necessarily write access
|
||||
self.sudo().write({'message_last_post': fields.Datetime.now()})
|
||||
if new_message.author_id and model and self.ids and message_type != 'notification' and not self._context.get('mail_create_nosubscribe'):
|
||||
self.message_subscribe([new_message.author_id.id])
|
||||
self.message_subscribe([new_message.author_id.id], force=False)
|
||||
return new_message
|
||||
|
||||
@api.multi
|
||||
|
||||
Reference in New Issue
Block a user