[FIX] addons: no unsubscribe for unsubscribed
The `/groups` route display mail.channel and allow: - a public user to subscribe specifying a mail address - a logged in user to subscribe/unsubscribe itself The `/groups?unsubscribe` route is the same but only allow: - a public user to unsubscribe specifying a mail address - a logged in user to unsubscribe itself When a user is logged in, there is the oddity that all mail.channel appear as to "unsubscribe" even if the user is not subscribed. With this commit, the unsubscribe is shown only if user is subscribed. opw-1861208 closes #25439
This commit is contained in:
@@ -8,6 +8,7 @@ sAnimation.registry.follow_alias = sAnimation.Class.extend({
|
||||
start: function () {
|
||||
var self = this;
|
||||
this.is_user = false;
|
||||
var unsubscribePage = window.location.search.slice(1).split('&').indexOf("unsubscribe") >= 0;
|
||||
this._rpc({
|
||||
route: '/groups/is_member',
|
||||
params: {
|
||||
@@ -19,6 +20,9 @@ sAnimation.registry.follow_alias = sAnimation.Class.extend({
|
||||
self.is_user = data.is_user;
|
||||
self.email = data.email;
|
||||
self.$target.find('.js_mg_link').attr('href', '/groups/' + self.$target.data('id'));
|
||||
if (unsubscribePage && self.is_user) {
|
||||
self.$target.find(".js_mg_follow_form").remove();
|
||||
}
|
||||
self.toggle_subscription(data.is_member ? 'on' : 'off', data.email);
|
||||
self.$target.removeClass("hidden");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user