diff options
| author | Mitali Patel <mpa@odoo.com> | 2019-06-27 05:31:53 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2020-01-17 10:29:08 +0000 |
| commit | 2d2b65ae8a67ba3e8d631bd0d711644823c4a19c (patch) | |
| tree | 3d66a742ea84f8af44a2ef6064065ccaf21b5382 /addons | |
| parent | 0b11ed87b6d428bc102ff3f258f3f635863cc60b (diff) | |
[IMP] mail: do not send email on join/leave mailing channel
Before this commit, when a user joined, left, or was invited to a
channel with "Send by email", it sent an email notification to every
member.
This commit disables email notification on subscribe/unsubscribe on
a channel, while still showing messages on join/leave.
Task-Id 2003281
closes odoo/odoo#35142
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/mail/models/mail_channel.py | 2 | ||||
| -rw-r--r-- | addons/mail/models/mail_thread.py | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py index 824fa893a69..ea1174c52ea 100644 --- a/addons/mail/models/mail_channel.py +++ b/addons/mail/models/mail_channel.py @@ -781,7 +781,7 @@ class Channel(models.Model): } else: notification = _('<div class="o_mail_notification">joined <a href="#" class="o_channel_redirect" data-oe-id="%s">#%s</a></div>') % (channel.id, channel.name,) - self.message_post(body=notification, message_type="notification", subtype_xmlid="mail.mt_comment", author_id=partner.id) + self.message_post(body=notification, message_type="notification", subtype_xmlid="mail.mt_comment", author_id=partner.id, notify_by_email=False) # broadcast the channel header to the added partner self._broadcast(partner_ids) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 0b7ac2b7b50..e560c7c2fb3 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -2100,7 +2100,7 @@ class MailThread(models.AbstractModel): # Notification API # ------------------------------------------------------ - def _notify_thread(self, message, msg_vals=False, **kwargs): + def _notify_thread(self, message, msg_vals=False, notify_by_email=True, **kwargs): """ Main notification method. This method basically does two things * call ``_notify_compute_recipients`` that computes recipients to @@ -2131,7 +2131,8 @@ class MailThread(models.AbstractModel): message_values['channel_ids'] = [(6, 0, [r['id'] for r in rdata['channels']])] self._notify_record_by_inbox(message, rdata, msg_vals=msg_vals, **kwargs) - self._notify_record_by_email(message, rdata, msg_vals=msg_vals, **kwargs) + if notify_by_email: + self._notify_record_by_email(message, rdata, msg_vals=msg_vals, **kwargs) return rdata |
