mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 20:16:39 -04:00

* [eslint] update eslint rules & add .eslintignore to ignore non-ready nova packages * [clean-up] nova-voting * [clean-up] [bug] nova-users: missing user parameter * [clean-up] nova-users * [clean-up] nova-subscribe * [clean-up] nova-settings * [clean-up] nova-rss * [clean-up] [bug] nova-posts: correct UsersRemoveDeletePosts * [clean-up] nova-posts * [clean-up] nova-notifications * [clean-up] [bug] nova-newsletter: no error.message on throw error * [clean-up] nova-newsletter * [clean-up] nova-lib * [clean-up] nova-kadira * [clean-up] nova-inject-data * [clean-up] nova-getting-started * [clean-up] nova-forms * [clean-up] nova-events * [clean-up] [bug] nova-embedly: no FlowRouter * [clean-up] nova-embedly * [clean-up] nova-email-templates * [clean-up] nova-email * [clean-up] nova-debug * [clean-up] nova-core * [clean-up] [bug] nova-comments: correct UsersRemoveDeleteComments * [clean-up] nova-comments * [clean-up] [bug] nova-cloudinary: use Telescope.settings.collection instand * [clean-up] nova-cloudinary * [clean-up] nova-categories * [clean-up] nova-base-components * [clean-up] nova-api * [eslint] extends react recommended * [clean-up] for jsx files * [eslint] extends meteor recommended * i forgot this one little change
36 lines
1 KiB
JavaScript
36 lines
1 KiB
JavaScript
// import Telescope from 'meteor/nova:lib';
|
|
import Comments from './collection.js';
|
|
import Posts from 'meteor/nova:posts';
|
|
import Users from 'meteor/nova:users';
|
|
|
|
Comments.helpers({getCollection: () => Comments});
|
|
Comments.helpers({getCollectionName: () => "comments"});
|
|
|
|
//////////////////
|
|
// Link Helpers //
|
|
//////////////////
|
|
|
|
/**
|
|
* @summary Get URL of a comment page.
|
|
* @param {Object} comment
|
|
*/
|
|
Comments.getPageUrl = function(comment, isAbsolute = false){
|
|
const post = Posts.findOne(comment.postId);
|
|
return `${Posts.getPageUrl(post, isAbsolute)}/#${comment._id}`;
|
|
};
|
|
Comments.helpers({getPageUrl: function (isAbsolute) {return Comments.getPageUrl(this, isAbsolute);}});
|
|
|
|
///////////////////
|
|
// Other Helpers //
|
|
///////////////////
|
|
|
|
/**
|
|
* @summary Get a comment author's name
|
|
* @param {Object} comment
|
|
*/
|
|
Comments.getAuthorName = function (comment) {
|
|
var user = Users.findOne(comment.userId);
|
|
return user ? user.getDisplayName() : comment.author;
|
|
};
|
|
Comments.helpers({getAuthorName: function () {return Comments.getAuthorName(this);}});
|
|
|