2015-06-24 15:38:14 +09:00
|
|
|
/**
|
|
|
|
* Use user and post properties to populate post notifications objects.
|
|
|
|
* @param {Object} post
|
|
|
|
*/
|
|
|
|
Posts.getNotificationProperties = function (post) {
|
|
|
|
var postAuthor = Meteor.users.findOne(post.userId);
|
|
|
|
var properties = {
|
|
|
|
postAuthorName : Posts.getAuthorName(post),
|
|
|
|
postTitle : Telescope.utils.cleanUp(post.title),
|
|
|
|
profileUrl: Users.getProfileUrl(postAuthor, true),
|
|
|
|
postUrl: Posts.getPageUrl(post, true),
|
|
|
|
thumbnailUrl: post.thumbnailUrl,
|
|
|
|
linkUrl: !!post.url ? Telescope.utils.getOutgoingUrl(post.url) : Posts.getPageUrl(post, true)
|
|
|
|
};
|
|
|
|
|
|
|
|
if(post.url)
|
|
|
|
properties.url = post.url;
|
|
|
|
|
|
|
|
if(post.htmlBody)
|
|
|
|
properties.htmlBody = post.htmlBody;
|
|
|
|
|
|
|
|
return properties;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use comment, user, and post properties to populate comment notifications objects.
|
|
|
|
* @param {Object} comment
|
|
|
|
*/
|
2015-06-25 10:44:35 +09:00
|
|
|
Comments.getNotificationProperties = function (comment, post) {
|
2015-06-24 15:38:14 +09:00
|
|
|
var commentAuthor = Meteor.users.findOne(comment.userId);
|
|
|
|
var properties = {
|
|
|
|
profileUrl: commentAuthor && commentAuthor.getProfileUrl(true),
|
|
|
|
postUrl: Posts.getPageUrl(post, true),
|
|
|
|
authorName : Comments.getAuthorName(comment),
|
2015-06-25 10:44:35 +09:00
|
|
|
postTitle: post.title,
|
2015-06-24 15:38:14 +09:00
|
|
|
htmlBody: comment.htmlBody,
|
|
|
|
commentUrl: Comments.getPageUrl(comment, true)
|
|
|
|
};
|
|
|
|
return properties;
|
|
|
|
};
|