[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>
This commit is contained in:
committed by
Alexandre Kühn
parent
0b11ed87b6
commit
2d2b65ae8a
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user