diff options
| author | gla <gla@odoo.com> | 2018-10-11 09:44:32 +0000 |
|---|---|---|
| committer | Geoffroy Larue <gla@odoo.com> | 2018-10-26 15:03:29 +0000 |
| commit | 42c6db1ece58f45b574e9df15919339ab4ca71d3 (patch) | |
| tree | 562170e089df914b9ec60f151fc70cda6d1ed572 | |
| parent | e10fd34682a0c55568cba66eb271b3aa5bed7c1d (diff) | |
[IMP] mass_mailing: warn when unsubscribing
Current behavior before PR:
When a lead or res.partner click in the 'unsubscribe' link in a mail that was sent to him via the mass mailing module (not via a particular mailing list), he is blacklisted from the whole mass mailing system. The only message he gets is "you have been successfully unsubscribed".
Desired behavior after PR is merged:
The user is told that he was unsubscribed, but in addition a warning is displayed telling him explicitly :
- to which mailing lists he was subscribed
- that he won't receive any mail from them anymore.
Purpose : Warn the user that unsubscribe via a lead or res.partner mass mailing that he won't receive any mail from the mailing lists (listed in the warning) he had subscribed, if any.
closes odoo/odoo#27678
| -rw-r--r-- | addons/mass_mailing/controllers/main.py | 5 | ||||
| -rw-r--r-- | addons/mass_mailing/views/unsubscribe_templates.xml | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/addons/mass_mailing/controllers/main.py b/addons/mass_mailing/controllers/main.py index 18b8a814dac..7d43038a3a6 100644 --- a/addons/mass_mailing/controllers/main.py +++ b/addons/mass_mailing/controllers/main.py @@ -62,6 +62,10 @@ class MassMailController(http.Controller): 'show_blacklist_button': request.env['ir.config_parameter'].sudo().get_param('mass_mailing.show_blacklist_buttons'), }) else: + opt_in_lists = request.env['mail.mass_mailing.list_contact_rel'].sudo().search([ + ('contact_id.email', '=', email), + ('opt_out', '=', False) + ]).mapped('list_id') blacklist_rec = request.env['mail.blacklist'].sudo()._add(email) self._log_blacklist_action( blacklist_rec, mailing_id, @@ -70,6 +74,7 @@ class MassMailController(http.Controller): 'email': email, 'mailing_id': mailing_id, 'res_id': res_id, + 'list_ids': opt_in_lists, 'show_blacklist_button': request.env['ir.config_parameter'].sudo().get_param( 'mass_mailing.show_blacklist_buttons'), }) diff --git a/addons/mass_mailing/views/unsubscribe_templates.xml b/addons/mass_mailing/views/unsubscribe_templates.xml index 1822ac08345..9417aeef044 100644 --- a/addons/mass_mailing/views/unsubscribe_templates.xml +++ b/addons/mass_mailing/views/unsubscribe_templates.xml @@ -71,6 +71,19 @@ <p>You have been successfully <strong>unsubscribed</strong>!</p> </div> + <div t-if="list_ids" class="alert alert-warning"> + <p class="text-center">You are currently subscribed to those newsletters. Unsubscribing means you will not receive any news from them anymore:</p> + <ul class="list-group mb-4"> + <t t-foreach="list_ids" t-as="list_id"> + <t t-if="list_id.is_public == True"> + <li class="list-group-item bg-transparent"> + <strong><t t-esc="list_id.name"/></strong> + </li> + </t> + </t> + </ul> + </div> + <div t-if="show_blacklist_button" class="mb64"> <div class="btn btn-secondary pull-right" id="button_add_blacklist" style="display:none">Blacklist Me</div> <div class="btn btn-secondary pull-right" id="button_remove_blacklist" style="display:none">Come Back</div> |
