[IMP] mail_compose_message: mass mailing does not auto_subscribe author anymore.
authorThibault Delavallée <tde@openerp.com>
Fri, 15 Mar 2013 12:40:09 +0000 (13:40 +0100)
committerThibault Delavallée <tde@openerp.com>
Fri, 15 Mar 2013 12:40:09 +0000 (13:40 +0100)
bzr revid: tde@openerp.com-20130315124009-xgfwr5xuxe1fhrut

addons/mail/mail_thread.py
addons/mail/wizard/mail_compose_message.py

index 3cdc0b2..b8bd028 100644 (file)
@@ -1030,7 +1030,7 @@ class mail_thread(osv.AbstractModel):
         # Create and auto subscribe the author
         msg_id = mail_message.create(cr, uid, values, context=context)
         message = mail_message.browse(cr, uid, msg_id, context=context)
-        if message.author_id and thread_id and type != 'notification':
+        if message.author_id and thread_id and type != 'notification' and not context.get('mail_create_nosubscribe'):
             self.message_subscribe(cr, uid, [thread_id], [message.author_id.id], context=context)
         return msg_id
 
index da89df5..9932d54 100644 (file)
@@ -205,6 +205,8 @@ class mail_compose_message(osv.TransientModel):
 
         for wizard in self.browse(cr, uid, ids, context=context):
             mass_mail_mode = wizard.composition_mode == 'mass_mail'
+            if mass_mail_mode:  # mass mail: avoid any auto subscription because this could lead to people being follower of plenty of documents
+                context['mail_create_nosubscribe'] = True
             active_model_pool = self.pool.get(wizard.model if wizard.model else 'mail.thread')
 
             # wizard works in batch mode: [res_id] or active_ids