summaryrefslogtreecommitdiff
path: root/addons/website_mail
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2014-07-16 22:51:43 +0200
committerOlivier Dony <odo@openerp.com>2014-07-16 23:21:30 +0200
commit6ac1deccf64e35de062ed960f84bd8a794d310d4 (patch)
tree05bfb24b38c1f22fe8e0af43b7bab28c46432309 /addons/website_mail
parent99556240299a8350f7b73534056e19ed2b1b3b39 (diff)
[FIX] mail, website_mail: specific mailing-list footer + better unsubscribe option
- remove the default footer for mail.group messages, replace with specific footer with archive and unsubscribe link - remove the automatic addition of user signature in mail.group messages, as many of them will be posted via the mail gateway and already contain a user signature. - make it easier to unsubscribe even when not logged in, as followers who have not signed up will have no way to login short of signing up. - remove tests looking for user signature in mail.group posts
Diffstat (limited to 'addons/website_mail')
-rw-r--r--addons/website_mail/static/src/js/follow.js24
-rw-r--r--addons/website_mail/views/website_mail.xml3
2 files changed, 16 insertions, 11 deletions
diff --git a/addons/website_mail/static/src/js/follow.js b/addons/website_mail/static/src/js/follow.js
index 18c36378328..a8b351efa6c 100644
--- a/addons/website_mail/static/src/js/follow.js
+++ b/addons/website_mail/static/src/js/follow.js
@@ -40,17 +40,21 @@
}
this.$target.removeClass('has-error');
- openerp.jsonRpc('/website_mail/follow', 'call', {
- 'id': +this.$target.data('id'),
- 'object': this.$target.data('object'),
- 'message_is_follower': this.$target.attr("data-follow") || "off",
- 'email': $email.length ? $email.val() : false,
- }).then(function (follow) {
- self.toggle_subscription(follow, self.email);
- });
+ var email = $email.length ? $email.val() : false;
+ if (email) {
+ openerp.jsonRpc('/website_mail/follow', 'call', {
+ 'id': +this.$target.data('id'),
+ 'object': this.$target.data('object'),
+ 'message_is_follower': this.$target.attr("data-follow") || "off",
+ 'email': email,
+ }).then(function (follow) {
+ self.toggle_subscription(follow, email);
+ });
+ }
},
toggle_subscription: function(follow, email) {
console.log(follow, email);
+ follow = follow || (!email && this.$target.attr('data-unsubscribe'));
if (follow) {
this.$target.find(".js_follow_btn").addClass("hidden");
this.$target.find(".js_unfollow_btn").removeClass("hidden");
@@ -60,8 +64,8 @@
this.$target.find(".js_unfollow_btn").addClass("hidden");
}
this.$target.find('input.js_follow_email')
- .val(email ? email : "")
- .attr("disabled", follow || (email.length && this.is_user) ? "disabled" : false);
+ .val(email || "")
+ .attr("disabled", email && (follow || this.is_user) ? "disabled" : false);
this.$target.attr("data-follow", follow ? 'on' : 'off');
},
});
diff --git a/addons/website_mail/views/website_mail.xml b/addons/website_mail/views/website_mail.xml
index 3b6d1bb96d6..8e365c1aaf5 100644
--- a/addons/website_mail/views/website_mail.xml
+++ b/addons/website_mail/views/website_mail.xml
@@ -5,7 +5,8 @@
<template id="follow">
<div class="input-group js_follow" t-att-data-id="object.id"
t-att-data-object="object._name"
- t-att-data-follow="object.id and object.message_is_follower and 'on' or 'off'">
+ t-att-data-follow="object.id and object.message_is_follower and 'on' or 'off'"
+ t-att-data-unsubscribe="'unsubscribe' if 'unsubscribe' in request.params else None">
<input
type="email" name="email"
class="js_follow_email form-control"