2015-09-18 16:27:59 +09:00
|
|
|
|
2015-09-18 11:21:01 +09:00
|
|
|
// Notification email
|
|
|
|
Picker.route('/email/notification/:id?', function(params, req, res, next) {
|
|
|
|
var notification = Herald.collection.findOne(params.id);
|
|
|
|
var notificationContents = buildEmailNotification(notification);
|
|
|
|
res.end(notificationContents.html);
|
|
|
|
});
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-09-18 11:21:01 +09:00
|
|
|
// New user email
|
|
|
|
Picker.route('/email/new-user/:id?', function(params, req, res, next) {
|
|
|
|
var html;
|
|
|
|
var user = Meteor.users.findOne(params.id);
|
|
|
|
var emailProperties = {
|
|
|
|
profileUrl: Users.getProfileUrl(user),
|
|
|
|
username: Users.getUserName(user)
|
|
|
|
};
|
|
|
|
html = Telescope.email.getTemplate('emailNewUser')(emailProperties);
|
|
|
|
res.end(Telescope.email.buildTemplate(html));
|
|
|
|
});
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-09-18 11:21:01 +09:00
|
|
|
// New post email
|
|
|
|
Picker.route('/email/new-post/:id?', function(params, req, res, next) {
|
|
|
|
var html;
|
|
|
|
var post = Posts.findOne(params.id);
|
|
|
|
if (!!post) {
|
|
|
|
html = Telescope.email.getTemplate('emailNewPost')(Posts.getNotificationProperties(post));
|
|
|
|
} else {
|
|
|
|
html = "<h3>No post found.</h3>"
|
|
|
|
}
|
|
|
|
res.end(Telescope.email.buildTemplate(html));
|
|
|
|
});
|
2015-06-24 15:38:14 +09:00
|
|
|
|
2015-09-18 11:21:01 +09:00
|
|
|
// Post approved
|
|
|
|
Picker.route('/email/post-approved/:id?', function(params, req, res, next) {
|
|
|
|
var html;
|
|
|
|
var post = Posts.findOne(params.id);
|
|
|
|
if (!!post) {
|
|
|
|
html = Telescope.email.getTemplate('emailPostApproved')(Posts.getNotificationProperties(post));
|
|
|
|
} else {
|
|
|
|
html = "<h3>No post found.</h3>"
|
|
|
|
}
|
|
|
|
res.end(Telescope.email.buildTemplate(html));
|
|
|
|
});
|
2015-06-24 15:38:14 +09:00
|
|
|
|
2015-09-18 11:21:01 +09:00
|
|
|
// New comment email
|
|
|
|
Picker.route('/email/new-comment/:id?', function(params, req, res, next) {
|
|
|
|
var html;
|
|
|
|
var comment = Comments.findOne(params.id);
|
|
|
|
var post = Posts.findOne(comment.postId);
|
|
|
|
if (!!comment) {
|
|
|
|
html = Telescope.email.getTemplate('emailNewComment')(Comments.getNotificationProperties(comment, post));
|
|
|
|
} else {
|
|
|
|
html = "<h3>No post found.</h3>"
|
|
|
|
}
|
|
|
|
res.end(Telescope.email.buildTemplate(html));
|
|
|
|
});
|
2015-06-24 15:38:14 +09:00
|
|
|
|
2015-09-18 11:21:01 +09:00
|
|
|
// New reply email
|
|
|
|
Picker.route('/email/new-comment/:id?', function(params, req, res, next) {
|
|
|
|
var html;
|
|
|
|
var comment = Comments.findOne(params.id);
|
|
|
|
var post = Posts.findOne(comment.postId);
|
|
|
|
if (!!comment) {
|
|
|
|
html = Telescope.email.getTemplate('emailNewReply')(Comments.getNotificationProperties(comment, post));
|
|
|
|
} else {
|
|
|
|
html = "<h3>No post found.</h3>"
|
|
|
|
}
|
|
|
|
res.end(Telescope.email.buildTemplate(html));
|
2015-09-18 16:27:59 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
// Account approved email
|
|
|
|
Picker.route('/email/account-approved/:id?', function(params, req, res, next) {
|
|
|
|
var user = Meteor.users.findOne(this.params.id);
|
|
|
|
var emailProperties = {
|
|
|
|
profileUrl: Users.getProfileUrl(user),
|
|
|
|
username: Users.getUserName(user),
|
|
|
|
siteTitle: Settings.get('title'),
|
|
|
|
siteUrl: Telescope.utils.getSiteUrl()
|
|
|
|
};
|
|
|
|
var html = Handlebars.templates.emailAccountApproved(emailProperties);
|
|
|
|
res.end(Telescope.email.buildTemplate(html));
|
2015-09-18 11:21:01 +09:00
|
|
|
});
|