getNotification = function(event, properties, context){ var notification = {}; // the default context to display notifications is the notification sidebar var context = typeof context === 'undefined' ? 'sidebar' : context; var p = properties; switch(event){ case 'newReply': notification.subject = 'Someone replied to your comment on "'+p.postHeadline+'"'; notification.text = p.commentAuthorName+' has replied to your comment on "'+p.postHeadline+'": '+getPostCommentUrl(p.postId, p.commentId); notification.html = '

'+p.commentAuthorName+' has replied to your comment on "'+p.postHeadline+'"

'; if(context === 'email') notification.html += '

'+p.commentExcerpt+'

Read more'; break; case 'newComment': notification.subject = 'A new comment on your post "'+p.postHeadline+'"'; notification.text = 'You have a new comment by '+p.commentAuthorName+' on your post "'+p.postHeadline+'": '+getPostCommentUrl(p.postId, p.commentId); notification.html = '

'+p.commentAuthorName+' left a new comment on your post "'+p.postHeadline+'"

'; if(context === 'email') notification.html += '

'+p.commentExcerpt+'

Read more'; break; case 'newPost': notification.subject = p.postAuthorName+' has created a new post: "'+p.postHeadline+'"'; notification.text = p.postAuthorName+' has created a new post: "'+p.postHeadline+'" '+getPostUrl(p.postId); notification.html = ''+p.postAuthorName+' has created a new post: "'+p.postHeadline+'".'; break; case 'accountApproved': notification.subject = 'Your account has been approved.'; notification.text = 'Welcome to '+getSetting('title')+'! Your account has just been approved.'; notification.html = 'Welcome to '+getSetting('title')+'!
Your account has just been approved. Start posting.'; break; default: break; } return notification; } Meteor.methods({ markAllNotificationsAsRead: function() { Notifications.update( {userId: Meteor.userId()}, { $set:{ read: true } }, {multi: true} ); } });