2015-04-22 07:50:11 +09:00
|
|
|
Template.unsubscribe.created = function(){
|
2015-09-18 16:27:59 +09:00
|
|
|
var hash = FlowRouter.getParam("hash");
|
2015-04-22 07:50:11 +09:00
|
|
|
Meteor.call('unsubscribeUser', hash, function(error, result){
|
|
|
|
if(result){
|
|
|
|
Session.set('unsubscribedMessage', __('you_have_been_unsubscribed_from_all_notifications'));
|
|
|
|
}else{
|
|
|
|
Session.set('unsubscribedMessage', __('user_not_found'));
|
|
|
|
}
|
|
|
|
});
|
2015-04-22 11:49:42 +09:00
|
|
|
Events.track('notificationsUnsubcribe', {hash: hash});
|
2015-04-22 07:50:11 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
Template.unsubscribe.helpers({
|
|
|
|
unsubscribed : function(){
|
|
|
|
// we have to use a session variable because the string we want to display
|
|
|
|
// depends on the return value of an asynchronous callback (unsubscribeUser)
|
|
|
|
return Session.get('unsubscribedMessage');
|
|
|
|
}
|
|
|
|
});
|