mirror of
https://github.com/vale981/Vulcan
synced 2025-03-04 09:11:43 -05:00
adding @summary for jsdocs compatibility
This commit is contained in:
parent
b89f1693a7
commit
104cad9b15
37 changed files with 214 additions and 155 deletions
|
@ -4,7 +4,7 @@
|
|||
// node.js install path, default to: "`which node`" on Mac and Linux, "`where node`" on Windows
|
||||
"nodePath": "",
|
||||
// Project docs path
|
||||
"docsPath": "~/nova-docs",
|
||||
"docsPath": "~/Dev/nova-docs",
|
||||
// Project docs Meteor server port, default to: 3333
|
||||
"meteorPort": 3333,
|
||||
// Copy the Meteor docs server before building the docs (required for the first build)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/**
|
||||
* Get all of a category's parents
|
||||
* @summary Get all of a category's parents
|
||||
* @param {Object} category
|
||||
*/
|
||||
Categories.getParents = function (category) {
|
||||
|
@ -19,7 +19,7 @@ Categories.getParents = function (category) {
|
|||
Categories.helpers({getParents: function () {return Categories.getParents(this);}});
|
||||
|
||||
/**
|
||||
* Get all of a category's children
|
||||
* @summary Get all of a category's children
|
||||
* @param {Object} category
|
||||
*/
|
||||
Categories.getChildren = function (category) {
|
||||
|
@ -38,7 +38,7 @@ Categories.getChildren = function (category) {
|
|||
Categories.helpers({getChildren: function () {return Categories.getChildren(this);}});
|
||||
|
||||
/**
|
||||
* Get all of a post's categories
|
||||
* @summary Get all of a post's categories
|
||||
* @param {Object} post
|
||||
*/
|
||||
Posts.getCategories = function (post) {
|
||||
|
@ -47,7 +47,7 @@ Posts.getCategories = function (post) {
|
|||
Posts.helpers({getCategories: function () {return Posts.getCategories(this);}});
|
||||
|
||||
/**
|
||||
* Get a category's URL
|
||||
* @summary Get a category's URL
|
||||
* @param {Object} category
|
||||
*/
|
||||
Categories.getUrl = function (category, isAbsolute) {
|
||||
|
@ -59,7 +59,7 @@ Categories.getUrl = function (category, isAbsolute) {
|
|||
Categories.helpers({getUrl: function () {return Categories.getUrl(this);}});
|
||||
|
||||
/**
|
||||
* Get a category's counter name
|
||||
* @summary Get a category's counter name
|
||||
* @param {Object} category
|
||||
*/
|
||||
Categories.getCounterName = function (category) {
|
||||
|
|
|
@ -16,7 +16,7 @@ Comments.before.update(function (userId, doc, fieldNames, modifier) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Disallow $rename
|
||||
* @summary Disallow $rename
|
||||
*/
|
||||
Comments.before.update(function (userId, doc, fieldNames, modifier) {
|
||||
if (!!modifier.$rename) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* The global namespace for Comments.
|
||||
* @summary The global namespace for Comments.
|
||||
* @namespace Comments
|
||||
*/
|
||||
Comments = new Mongo.Collection("comments");
|
||||
|
||||
/**
|
||||
* Comments schema
|
||||
* @summary Comments schema
|
||||
* @type {SimpleSchema}
|
||||
*/
|
||||
Comments.schema = new SimpleSchema({
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//////////////////
|
||||
|
||||
/**
|
||||
* Get URL of a comment page.
|
||||
* @summary Get URL of a comment page.
|
||||
* @param {Object} comment
|
||||
*/
|
||||
Comments.getPageUrl = function(comment, isAbsolute){
|
||||
|
@ -18,7 +18,7 @@ Comments.helpers({getPageUrl: function () {return Comments.getPageUrl(this);}});
|
|||
///////////////////
|
||||
|
||||
/**
|
||||
* Get a comment author's name
|
||||
* @summary Get a comment author's name
|
||||
* @param {Object} comment
|
||||
*/
|
||||
Comments.getAuthorName = function (comment) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
Comments.parameters = {};
|
||||
|
||||
/**
|
||||
* Gives an object containing the appropriate find
|
||||
* @summary Gives an object containing the appropriate find
|
||||
* and options arguments for the subscriptions's Comments.find()
|
||||
* @memberof Parameters
|
||||
* @param {Object} terms
|
||||
*/
|
||||
Comments.parameters.get = function (terms) {
|
||||
|
|
|
@ -3,7 +3,7 @@ import PublicationsUtils from 'meteor/utilities:smart-publications';
|
|||
Comments.publishedFields = {};
|
||||
|
||||
/**
|
||||
* Specify which fields should be published by the posts.list publication
|
||||
* @summary Specify which fields should be published by the posts.list publication
|
||||
* @array Posts.publishedFields.list
|
||||
*/
|
||||
Comments.publishedFields.list = PublicationsUtils.arrayToFields([
|
||||
|
@ -21,7 +21,7 @@ Comments.publishedFields.list = PublicationsUtils.arrayToFields([
|
|||
]);
|
||||
|
||||
/**
|
||||
* Specify which fields should be published by the posts.single publication
|
||||
* @summary Specify which fields should be published by the posts.single publication
|
||||
* @array Posts.publishedFields.single
|
||||
*/
|
||||
Comments.publishedFields.single = PublicationsUtils.arrayToFields(Comments.getPublishedFields());
|
|
@ -2,7 +2,7 @@ Comments._ensureIndex({postId: 1});
|
|||
Comments._ensureIndex({parentCommentId: 1});
|
||||
|
||||
/**
|
||||
* Publish a list of comments, along with the posts and users corresponding to these comments
|
||||
* @summary Publish a list of comments, along with the posts and users corresponding to these comments
|
||||
* @param {Object} terms
|
||||
*/
|
||||
Meteor.publish('comments.list', function (terms) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* Comment views are filters used for subscribing to and viewing comments
|
||||
* @summary Comment views are filters used for subscribing to and viewing comments
|
||||
* @namespace Comments.views
|
||||
*/
|
||||
Comments.views = {};
|
||||
|
||||
/**
|
||||
* Add a module to a comment view
|
||||
* @summary Add a module to a comment view
|
||||
* @param {string} viewName - The name of the view
|
||||
* @param {function} [viewFunction] - The function used to calculate query terms. Takes terms and baseParameters arguments
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@ var modifyKarma = function (userId, karma) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Update an item's (post or comment) score
|
||||
* @summary Update an item's (post or comment) score
|
||||
* @param {object} item - The item being operated on
|
||||
* @param {object} user - The user doing the operation
|
||||
* @param {object} collection - The collection the item belongs to
|
||||
|
@ -18,7 +18,7 @@ Telescope.callbacks.add("cancelUpvote.async", updateScore);
|
|||
Telescope.callbacks.add("cancelDownvote.async", updateScore);
|
||||
|
||||
/**
|
||||
* Update the profile of the user doing the operation
|
||||
* @summary Update the profile of the user doing the operation
|
||||
* @param {object} item - The item being operated on
|
||||
* @param {object} user - The user doing the operation
|
||||
* @param {object} collection - The collection the item belongs to
|
||||
|
@ -58,7 +58,7 @@ Telescope.callbacks.add("cancelUpvote.async", updateUser);
|
|||
Telescope.callbacks.add("cancelDownvote.async", updateUser);
|
||||
|
||||
/**
|
||||
* Update the karma of the item's owner
|
||||
* @summary Update the karma of the item's owner
|
||||
* @param {object} item - The item being operated on
|
||||
* @param {object} user - The user doing the operation
|
||||
* @param {object} collection - The collection the item belongs to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* A dictionnary of all the elements that use custom colors
|
||||
* @summary A dictionnary of all the elements that use custom colors
|
||||
*/
|
||||
|
||||
Telescope.colorElements = {};
|
||||
|
@ -19,7 +19,7 @@ Telescope.colorElements.defaultColors = {
|
|||
};
|
||||
|
||||
/**
|
||||
* Register an element to use a custom color
|
||||
* @summary Register an element to use a custom color
|
||||
* @param {string} selector - the CSS selector of the element
|
||||
* @param {string} color - the color. Either `accentColor`, `accentContrastColor`, `secondaryColor`, or `secondaryContrastColor`
|
||||
* @param {string} [property=color] - the property to colorize. Usually `color`, `background-color`, `border-color`, etc.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ------------------------------ Dynamic Icons ------------------------------ //
|
||||
|
||||
/**
|
||||
* Take an icon name (such as "open") and return the HTML code to display the icon
|
||||
* @summary Take an icon name (such as "open") and return the HTML code to display the icon
|
||||
* @param {string} iconName - the name of the icon
|
||||
* @param {string} [iconClass] - an optional class to assign to the icon
|
||||
*/
|
||||
|
@ -13,7 +13,7 @@ Telescope.utils.getIcon = function (iconName, iconClass) {
|
|||
};
|
||||
|
||||
/**
|
||||
* A directory of icon keys and icon codes
|
||||
* @summary A directory of icon keys and icon codes
|
||||
*/
|
||||
Telescope.utils.icons = {
|
||||
expand: "angle-right",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Telescope Telescope.email namespace
|
||||
* @summary Telescope Telescope.email namespace
|
||||
* @namespace Telescope.email
|
||||
*/
|
||||
Telescope.email = {};
|
||||
|
|
|
@ -43,7 +43,7 @@ fieldSchema: {
|
|||
});
|
||||
|
||||
/**
|
||||
* Copy over profile.isDummy to telescope.isDummy on user creation
|
||||
* @summary Copy over profile.isDummy to telescope.isDummy on user creation
|
||||
* @param {Object} user – the user object being iterated on and returned
|
||||
* @param {Object} options – user options
|
||||
*/
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* Callback hooks provide an easy way to add extra steps to common operations.
|
||||
* @summary Callback hooks provide an easy way to add extra steps to common operations.
|
||||
* @namespace Telescope.callbacks
|
||||
*/
|
||||
Telescope.callbacks = {};
|
||||
|
||||
/**
|
||||
* Add a callback function to a hook
|
||||
* @summary Add a callback function to a hook
|
||||
* @param {String} hook - The name of the hook
|
||||
* @param {Function} callback - The callback function
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ Telescope.callbacks.add = function (hook, callback) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Remove a callback from a hook
|
||||
* @summary Remove a callback from a hook
|
||||
* @param {string} hook - The name of the hook
|
||||
* @param {string} functionName - The name of the function to remove
|
||||
*/
|
||||
|
@ -31,7 +31,7 @@ Telescope.callbacks.remove = function (hookName, callbackName) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Successively run all of a hook's callbacks on an item
|
||||
* @summary Successively run all of a hook's callbacks on an item
|
||||
* @param {String} hook - The name of the hook
|
||||
* @param {Object} item - The post, comment, modifier, etc. on which to run the callbacks
|
||||
* @param {Object} [constant] - An optional constant that will be passed along to each callback
|
||||
|
@ -54,7 +54,7 @@ Telescope.callbacks.run = function (hook, item, constant) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Successively run all of a hook's callbacks on an item, in async mode (only works on server)
|
||||
* @summary Successively run all of a hook's callbacks on an item, in async mode (only works on server)
|
||||
* @param {String} hook - The name of the hook
|
||||
* @param {Object} item - The post, comment, modifier, etc. on which to run the callbacks
|
||||
* @param {Object} [constant] - An optional constant that will be passed along to each callback
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/**
|
||||
* Meteor Collections.
|
||||
* @summary Meteor Collections.
|
||||
* @class Mongo.Collection
|
||||
*/
|
||||
|
||||
/**
|
||||
* @summary Add an additional field (or an array of fields) to a schema.
|
||||
* @summary @summary Add an additional field (or an array of fields) to a schema.
|
||||
* @param {Object|Object[]} field
|
||||
*/
|
||||
Mongo.Collection.prototype.addField = function (fieldOrFieldArray) {
|
||||
|
@ -24,7 +24,7 @@ Mongo.Collection.prototype.addField = function (fieldOrFieldArray) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Remove a field from a schema.
|
||||
* @summary Remove a field from a schema.
|
||||
* @param {String} fieldName
|
||||
*/
|
||||
Mongo.Collection.prototype.removeField = function (fieldName) {
|
||||
|
@ -37,7 +37,7 @@ Mongo.Collection.prototype.removeField = function (fieldName) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Global schemas object. Note: not reactive, won't be updated after initialization
|
||||
* @summary Global schemas object. Note: not reactive, won't be updated after initialization
|
||||
* @namespace Telescope.schemas
|
||||
*/
|
||||
Telescope.schemas = {};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Kick off the global namespace for Telescope.
|
||||
* @summary Kick off the global namespace for Telescope.
|
||||
* @namespace Telescope
|
||||
*/
|
||||
|
||||
|
@ -10,7 +10,7 @@ Telescope.VERSION = '0.25.7';
|
|||
// ------------------------------------- Config -------------------------------- //
|
||||
|
||||
/**
|
||||
* Telescope configuration namespace
|
||||
* @summary Telescope configuration namespace
|
||||
* @namespace Telescope.config
|
||||
*/
|
||||
Telescope.config = {};
|
||||
|
@ -44,13 +44,13 @@ Telescope.getComponent = (name) => {
|
|||
// ------------------------------------- Subscriptions -------------------------------- //
|
||||
|
||||
/**
|
||||
* Subscriptions namespace
|
||||
* @summary Subscriptions namespace
|
||||
* @namespace Telescope.subscriptions
|
||||
*/
|
||||
Telescope.subscriptions = [];
|
||||
|
||||
/**
|
||||
* Add a subscription to be preloaded
|
||||
* @summary Add a subscription to be preloaded
|
||||
* @param {string} subscription - The name of the subscription
|
||||
*/
|
||||
Telescope.subscriptions.preload = function (subscription, args) {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
/**
|
||||
* The global namespace for Telescope utils.
|
||||
* @summary The global namespace for Telescope utils.
|
||||
* @namespace Telescope.utils
|
||||
*/
|
||||
Telescope.utils = {};
|
||||
|
||||
/**
|
||||
* Convert a camelCase string to dash-separated string
|
||||
* @summary Convert a camelCase string to dash-separated string
|
||||
* @param {String} str
|
||||
*/
|
||||
Telescope.utils.camelToDash = function (str) {
|
||||
|
@ -14,7 +14,7 @@ Telescope.utils.camelToDash = function (str) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Convert a camelCase string to a space-separated capitalized string
|
||||
* @summary Convert a camelCase string to a space-separated capitalized string
|
||||
* See http://stackoverflow.com/questions/4149276/javascript-camelcase-to-regular-form
|
||||
* @param {String} str
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@ Telescope.utils.camelToSpaces = function (str) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Convert an underscore-separated string to dash-separated string
|
||||
* @summary Convert an underscore-separated string to dash-separated string
|
||||
* @param {String} str
|
||||
*/
|
||||
Telescope.utils.underscoreToDash = function (str) {
|
||||
|
@ -31,7 +31,7 @@ Telescope.utils.underscoreToDash = function (str) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Convert a dash separated string to camelCase.
|
||||
* @summary Convert a dash separated string to camelCase.
|
||||
* @param {String} str
|
||||
*/
|
||||
Telescope.utils.dashToCamel = function (str) {
|
||||
|
@ -39,7 +39,7 @@ Telescope.utils.dashToCamel = function (str) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Convert a string to camelCase and remove spaces.
|
||||
* @summary Convert a string to camelCase and remove spaces.
|
||||
* @param {String} str
|
||||
*/
|
||||
Telescope.utils.camelCaseify = function(str) {
|
||||
|
@ -49,7 +49,7 @@ Telescope.utils.camelCaseify = function(str) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Trim a sentence to a specified amount of words and append an ellipsis.
|
||||
* @summary Trim a sentence to a specified amount of words and append an ellipsis.
|
||||
* @param {String} s - Sentence to trim.
|
||||
* @param {Number} numWords - Number of words to trim sentence to.
|
||||
*/
|
||||
|
@ -65,7 +65,7 @@ Telescope.utils.trimWords = function(s, numWords) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Trim a block of HTML code to get a clean text excerpt
|
||||
* @summary Trim a block of HTML code to get a clean text excerpt
|
||||
* @param {String} html - HTML to trim.
|
||||
*/
|
||||
Telescope.utils.trimHTML = function (html, numWords) {
|
||||
|
@ -74,7 +74,7 @@ Telescope.utils.trimHTML = function (html, numWords) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Capitalize a string.
|
||||
* @summary Capitalize a string.
|
||||
* @param {String} str
|
||||
*/
|
||||
Telescope.utils.capitalise = function(str) {
|
||||
|
@ -111,14 +111,14 @@ Telescope.utils.getDateRange = function(pageNumber) {
|
|||
//////////////////////////
|
||||
|
||||
/**
|
||||
* Returns the user defined site URL or Meteor.absoluteUrl
|
||||
* @summary Returns the user defined site URL or Meteor.absoluteUrl
|
||||
*/
|
||||
Telescope.utils.getSiteUrl = function () {
|
||||
return Telescope.settings.get('siteUrl', Meteor.absoluteUrl());
|
||||
};
|
||||
|
||||
/**
|
||||
* The global namespace for Telescope utils.
|
||||
* @summary The global namespace for Telescope utils.
|
||||
* @param {String} url - the URL to redirect
|
||||
*/
|
||||
Telescope.utils.getOutgoingUrl = function (url) {
|
||||
|
|
|
@ -19,7 +19,7 @@ Posts.views.add("campaign", function (terms) {
|
|||
const Campaign = {};
|
||||
|
||||
/**
|
||||
* Return an array containing the latest n posts that can be sent in a newsletter
|
||||
* @summary Return an array containing the latest n posts that can be sent in a newsletter
|
||||
* @param {Number} postsCount
|
||||
*/
|
||||
Campaign.getPosts = function (postsCount) {
|
||||
|
@ -41,7 +41,7 @@ Campaign.getPosts = function (postsCount) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Build a newsletter campaign from an array of posts
|
||||
* @summary Build a newsletter campaign from an array of posts
|
||||
* (Called from Campaign.scheduleNextWithMailChimp)
|
||||
* @param {Array} postsArray
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Generate HTML body and excerpt from Markdown on post insert
|
||||
* @summary Generate HTML body and excerpt from Markdown on post insert
|
||||
*/
|
||||
Posts.before.insert(function (userId, doc) {
|
||||
if(!!doc.body) {
|
||||
|
@ -15,7 +15,7 @@ Posts.before.insert(function (userId, doc) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Generate HTML body and excerpt from Markdown when post body is updated
|
||||
* @summary Generate HTML body and excerpt from Markdown when post body is updated
|
||||
*/
|
||||
Posts.before.update(function (userId, doc, fieldNames, modifier) {
|
||||
// if body is being modified or $unset, update htmlBody too
|
||||
|
@ -31,7 +31,7 @@ Posts.before.update(function (userId, doc, fieldNames, modifier) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Generate slug when post title is updated
|
||||
* @summary Generate slug when post title is updated
|
||||
*/
|
||||
Posts.before.update(function (userId, doc, fieldNames, modifier) {
|
||||
// if title is being modified, update slug too
|
||||
|
@ -41,7 +41,7 @@ Posts.before.update(function (userId, doc, fieldNames, modifier) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Disallow $rename
|
||||
* @summary Disallow $rename
|
||||
*/
|
||||
Posts.before.update(function (userId, doc, fieldNames, modifier) {
|
||||
if (!!modifier.$rename) {
|
||||
|
@ -58,7 +58,7 @@ Posts.before.update(function (userId, doc, fieldNames, modifier) {
|
|||
// ------------------------------------- posts.new.method -------------------------------- //
|
||||
|
||||
/**
|
||||
* Check that the current user can post
|
||||
* @summary Check that the current user can post
|
||||
*/
|
||||
function clientSubmitChecks (post, user) {
|
||||
// check that user can post
|
||||
|
@ -69,7 +69,7 @@ function clientSubmitChecks (post, user) {
|
|||
Telescope.callbacks.add("posts.new.method", clientSubmitChecks);
|
||||
|
||||
/**
|
||||
* Rate limiting
|
||||
* @summary Rate limiting
|
||||
*/
|
||||
function rateLimiting (post, user) {
|
||||
|
||||
|
@ -95,7 +95,7 @@ function rateLimiting (post, user) {
|
|||
Telescope.callbacks.add("posts.new.method", rateLimiting);
|
||||
|
||||
/**
|
||||
* Properties
|
||||
* @summary Properties
|
||||
*/
|
||||
function propertyChecks (post, user) {
|
||||
|
||||
|
@ -122,7 +122,7 @@ function propertyChecks (post, user) {
|
|||
Telescope.callbacks.add("posts.new.method", propertyChecks);
|
||||
|
||||
/**
|
||||
* Properties
|
||||
* @summary Properties
|
||||
*/
|
||||
function methodDefaultProperties (post, user) {
|
||||
|
||||
|
@ -145,7 +145,7 @@ Telescope.callbacks.add("posts.new.method", methodDefaultProperties);
|
|||
// ------------------------------------- posts.new.sync -------------------------------- //
|
||||
|
||||
/**
|
||||
* Check for necessary properties
|
||||
* @summary Check for necessary properties
|
||||
*/
|
||||
function postSubmitChecks (post, user) {
|
||||
// check that a title was provided
|
||||
|
@ -159,7 +159,7 @@ function postSubmitChecks (post, user) {
|
|||
Telescope.callbacks.add("posts.new.sync", postSubmitChecks);
|
||||
|
||||
/**
|
||||
* Set properties to default values if missing
|
||||
* @summary Set properties to default values if missing
|
||||
*/
|
||||
function setProperties (post, user) {
|
||||
|
||||
|
@ -190,7 +190,7 @@ function setProperties (post, user) {
|
|||
Telescope.callbacks.add("posts.new.sync", setProperties);
|
||||
|
||||
/**
|
||||
* Set postedAt date
|
||||
* @summary Set postedAt date
|
||||
*/
|
||||
function setPostedAt (post, user) {
|
||||
// if post is approved but doesn't have a postedAt date, give it a default date
|
||||
|
@ -205,7 +205,7 @@ Telescope.callbacks.add("posts.new.sync", setPostedAt);
|
|||
// ------------------------------------- posts.new.async -------------------------------- //
|
||||
|
||||
/**
|
||||
* Increment the user's post count
|
||||
* @summary Increment the user's post count
|
||||
*/
|
||||
function incrementPostCount (post) {
|
||||
var userId = post.userId;
|
||||
|
@ -215,7 +215,7 @@ function incrementPostCount (post) {
|
|||
Telescope.callbacks.add("posts.new.async", incrementPostCount);
|
||||
|
||||
/**
|
||||
* Make users upvote their own new posts
|
||||
* @summary Make users upvote their own new posts
|
||||
*/
|
||||
if (typeof Telescope.operateOnItem !== "undefined") {
|
||||
function upvoteOwnPost (post) {
|
||||
|
@ -227,7 +227,7 @@ if (typeof Telescope.operateOnItem !== "undefined") {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add new post notification callback on post submit
|
||||
* @summary Add new post notification callback on post submit
|
||||
*/
|
||||
if (typeof Telescope.notifications !== "undefined") {
|
||||
function postSubmitNotification (post) {
|
||||
|
@ -254,7 +254,7 @@ if (typeof Telescope.notifications !== "undefined") {
|
|||
Telescope.callbacks.add("posts.new.async", postSubmitNotification);
|
||||
|
||||
/**
|
||||
* Add notification callback when a post is approved
|
||||
* @summary Add notification callback when a post is approved
|
||||
*/
|
||||
|
||||
function postApprovedNotification (post) {
|
||||
|
@ -275,7 +275,7 @@ if (typeof Telescope.notifications !== "undefined") {
|
|||
// ------------------------------------- posts.edit.sync -------------------------------- //
|
||||
|
||||
/**
|
||||
* Force sticky to default to false when it's not specified
|
||||
* @summary Force sticky to default to false when it's not specified
|
||||
*/
|
||||
function forceStickyToFalse (modifier, post) {
|
||||
if (!modifier.$set.sticky) {
|
||||
|
@ -289,7 +289,7 @@ Telescope.callbacks.add("posts.edit.sync", forceStickyToFalse);
|
|||
// ------------------------------------- posts.edit.async -------------------------------- //
|
||||
|
||||
/**
|
||||
* Set postedAt date
|
||||
* @summary Set postedAt date
|
||||
*/
|
||||
function setPostedAtOnEdit (post, oldPost) {
|
||||
// if post is approved but doesn't have a postedAt date, give it a default date
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Posts schema
|
||||
* @summary Posts schema
|
||||
* @type {SimpleSchema}
|
||||
*/
|
||||
Posts.schema = new SimpleSchema({
|
||||
|
@ -224,6 +224,6 @@ Posts.schema = new SimpleSchema({
|
|||
// });
|
||||
|
||||
/**
|
||||
* Attach schema to Posts collection
|
||||
* @summary Attach schema to Posts collection
|
||||
*/
|
||||
Posts.attachSchema(Posts.schema);
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
/**
|
||||
* The global namespace/collection for Posts.
|
||||
* @summary The global namespace/collection for Posts.
|
||||
* @namespace Posts
|
||||
*/
|
||||
Posts = new Mongo.Collection("posts");
|
||||
|
||||
/**
|
||||
* Posts config namespace
|
||||
* @summary Posts config namespace
|
||||
* @type {Object}
|
||||
*/
|
||||
Posts.config = {};
|
||||
|
||||
|
||||
/**
|
||||
* Post Statuses
|
||||
* @summary Post Statuses
|
||||
*/
|
||||
Posts.config.postStatuses = [
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//////////////////
|
||||
|
||||
/**
|
||||
* Return a post's link if it has one, else return its post page URL
|
||||
* @summary Return a post's link if it has one, else return its post page URL
|
||||
* @param {Object} post
|
||||
*/
|
||||
Posts.getLink = function (post, isAbsolute) {
|
||||
|
@ -12,7 +12,7 @@ Posts.getLink = function (post, isAbsolute) {
|
|||
Posts.helpers({getLink: function (isAbsolute) {return Posts.getLink(this, isAbsolute);}});
|
||||
|
||||
/**
|
||||
* Depending on the settings, return either a post's URL link (if it has one) or its page URL.
|
||||
* @summary Depending on the settings, return either a post's URL link (if it has one) or its page URL.
|
||||
* @param {Object} post
|
||||
*/
|
||||
Posts.getShareableLink = function (post) {
|
||||
|
@ -21,7 +21,7 @@ Posts.getShareableLink = function (post) {
|
|||
Posts.helpers({getShareableLink: function () {return Posts.getShareableLink(this);}});
|
||||
|
||||
/**
|
||||
* Whether a post's link should open in a new tab or not
|
||||
* @summary Whether a post's link should open in a new tab or not
|
||||
* @param {Object} post
|
||||
*/
|
||||
Posts.getLinkTarget = function (post) {
|
||||
|
@ -30,7 +30,7 @@ Posts.getLinkTarget = function (post) {
|
|||
Posts.helpers({getLinkTarget: function () {return Posts.getLinkTarget(this);}});
|
||||
|
||||
/**
|
||||
* Get URL of a post page.
|
||||
* @summary Get URL of a post page.
|
||||
* @param {Object} post
|
||||
*/
|
||||
Posts.getPageUrl = function(post, isAbsolute){
|
||||
|
@ -41,7 +41,7 @@ Posts.getPageUrl = function(post, isAbsolute){
|
|||
Posts.helpers({getPageUrl: function (isAbsolute) {return Posts.getPageUrl(this, isAbsolute);}});
|
||||
|
||||
/**
|
||||
* Get post edit page URL.
|
||||
* @summary Get post edit page URL.
|
||||
* @param {String} id
|
||||
*/
|
||||
Posts.getEditUrl = function(post, isAbsolute){
|
||||
|
@ -56,7 +56,7 @@ Posts.helpers({getEditUrl: function (isAbsolute) {return Posts.getEditUrl(this,
|
|||
///////////////////
|
||||
|
||||
/**
|
||||
* Get a post author's name
|
||||
* @summary Get a post author's name
|
||||
* @param {Object} post
|
||||
*/
|
||||
Posts.getAuthorName = function (post) {
|
||||
|
@ -70,7 +70,7 @@ Posts.getAuthorName = function (post) {
|
|||
Posts.helpers({getAuthorName: function () {return Posts.getAuthorName(this);}});
|
||||
|
||||
/**
|
||||
* Get default status for new posts.
|
||||
* @summary Get default status for new posts.
|
||||
* @param {Object} user
|
||||
*/
|
||||
Posts.getDefaultStatus = function (user) {
|
||||
|
@ -84,7 +84,7 @@ Posts.getDefaultStatus = function (user) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Check if a post is approved
|
||||
* @summary Check if a post is approved
|
||||
* @param {Object} post
|
||||
*/
|
||||
Posts.isApproved = function (post) {
|
||||
|
@ -93,7 +93,7 @@ Posts.isApproved = function (post) {
|
|||
Posts.helpers({isApproved: function () {return Posts.isApproved(this);}});
|
||||
|
||||
/**
|
||||
* Check to see if post URL is unique.
|
||||
* @summary Check to see if post URL is unique.
|
||||
* We need the current user so we know who to upvote the existing post as.
|
||||
* @param {String} url
|
||||
*/
|
||||
|
@ -109,14 +109,14 @@ Posts.checkForSameUrl = function (url) {
|
|||
};
|
||||
|
||||
/**
|
||||
* When on a post page, return the current post
|
||||
* @summary When on a post page, return the current post
|
||||
*/
|
||||
Posts.current = function () {
|
||||
return Posts.findOne(FlowRouter.getParam("_id"));
|
||||
};
|
||||
|
||||
/**
|
||||
* Check to see if a post is a link to a video
|
||||
* @summary Check to see if a post is a link to a video
|
||||
* @param {Object} post
|
||||
*/
|
||||
Posts.isVideo = function (post) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
Posts.methods = {};
|
||||
/**
|
||||
* Insert a post in the database (note: optional post properties not listed here)
|
||||
* @summary Insert a post in the database (note: optional post properties not listed here)
|
||||
* @param {Object} post - the post being inserted
|
||||
* @param {string} post.userId - the id of the user the post belongs to
|
||||
* @param {string} post.title - the post's title
|
||||
|
@ -26,7 +26,7 @@ Posts.methods.new = function (post) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Edit a post in the database
|
||||
* @summary Edit a post in the database
|
||||
* @param {string} postId – the ID of the post being edited
|
||||
* @param {Object} modifier – the modifier object
|
||||
* @param {Object} post - the current post object
|
||||
|
@ -55,8 +55,9 @@ var postViews = [];
|
|||
Meteor.methods({
|
||||
|
||||
/**
|
||||
* Meteor method for submitting a post from the client
|
||||
* @summary Meteor method for submitting a post from the client
|
||||
* @memberof Posts
|
||||
* @isMethod true
|
||||
* @param {Object} post - the post being inserted
|
||||
*/
|
||||
'posts.new': function(post){
|
||||
|
@ -86,8 +87,9 @@ Meteor.methods({
|
|||
},
|
||||
|
||||
/**
|
||||
* Meteor method for editing a post from the client
|
||||
* @summary Meteor method for editing a post from the client
|
||||
* @memberof Posts
|
||||
* @isMethod true
|
||||
* @param {Object} modifier - the update modifier
|
||||
* @param {Object} postId - the id of the post being updated
|
||||
*/
|
||||
|
@ -127,6 +129,12 @@ Meteor.methods({
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
* @summary Meteor method for approving a post
|
||||
* @memberof Posts
|
||||
* @isMethod true
|
||||
* @param {String} postId - the id of the post to approve
|
||||
*/
|
||||
'posts.approve': function(postId){
|
||||
|
||||
check(postId, String);
|
||||
|
@ -151,6 +159,12 @@ Meteor.methods({
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @summary Meteor method for rejecting a post
|
||||
* @memberof Posts
|
||||
* @isMethod true
|
||||
* @param {String} postId - the id of the post to reject
|
||||
*/
|
||||
'posts.reject': function(postId){
|
||||
|
||||
check(postId, String);
|
||||
|
@ -167,6 +181,12 @@ Meteor.methods({
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @summary Meteor method for increasing the number of views on a post
|
||||
* @memberof Posts
|
||||
* @isMethod true
|
||||
* @param {String} postId - the id of the post
|
||||
*/
|
||||
'posts.increaseViews': function(postId, sessionId){
|
||||
|
||||
check(postId, String);
|
||||
|
@ -183,6 +203,12 @@ Meteor.methods({
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @summary Meteor method for deleting a post
|
||||
* @memberof Posts
|
||||
* @isMethod true
|
||||
* @param {String} postId - the id of the post
|
||||
*/
|
||||
'posts.deleteById': function(postId) {
|
||||
|
||||
check(postId, String);
|
||||
|
@ -207,25 +233,56 @@ Meteor.methods({
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
* @summary Check for other posts with the same URL
|
||||
* @memberof Posts
|
||||
* @isMethod true
|
||||
* @param {String} url - the URL to check
|
||||
*/
|
||||
'posts.checkForDuplicates': function (url) {
|
||||
Posts.checkForSameUrl(url);
|
||||
},
|
||||
|
||||
/**
|
||||
* Upvote a post
|
||||
* @memberof Posts
|
||||
* @isMethod true
|
||||
* @param {String} postId - the id of the post
|
||||
*/
|
||||
'posts.upvote': function (postId) {
|
||||
check(postId, String);
|
||||
return Telescope.operateOnItem.call(this, Posts, postId, Meteor.user(), "upvote");
|
||||
},
|
||||
|
||||
/**
|
||||
* Downvote a post
|
||||
* @memberof Posts
|
||||
* @isMethod true
|
||||
* @param {String} postId - the id of the post
|
||||
*/
|
||||
'posts.downvote': function (postId) {
|
||||
check(postId, String);
|
||||
return Telescope.operateOnItem.call(this, Posts, postId, Meteor.user(), "downvote");
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Cancel an upvote on a post
|
||||
* @memberof Posts
|
||||
* @isMethod true
|
||||
* @param {String} postId - the id of the post
|
||||
*/
|
||||
'posts.cancelUpvote': function (postId) {
|
||||
check(postId, String);
|
||||
return Telescope.operateOnItem.call(this, Posts, postId, Meteor.user(), "cancelUpvote");
|
||||
},
|
||||
|
||||
/**
|
||||
* Cancel a downvote on a post
|
||||
* @memberof Posts
|
||||
* @isMethod true
|
||||
* @param {String} postId - the id of the post
|
||||
*/
|
||||
'posts.cancelDownvote': function (postId) {
|
||||
check(postId, String);
|
||||
return Telescope.operateOnItem.call(this, Posts, postId, Meteor.user(), "cancelDownvote");
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
/**
|
||||
* Parameter callbacks let you add parameters to subscriptions
|
||||
* @summary Parameter callbacks let you add parameters to subscriptions
|
||||
* @namespace Posts.parameters
|
||||
*/
|
||||
Posts.parameters = {};
|
||||
|
||||
/**
|
||||
* Takes a set of terms, and translates them into a `parameter` object containing the appropriate find
|
||||
* @summary Takes a set of terms, and translates them into a `parameter` object containing the appropriate find
|
||||
* and options arguments for the subscriptions's Posts.find()
|
||||
* @memberof Parameters
|
||||
* @param {Object} terms
|
||||
*/
|
||||
Posts.parameters.get = function (terms) {
|
||||
|
|
|
@ -3,7 +3,7 @@ import PublicationsUtils from 'meteor/utilities:smart-publications';
|
|||
Posts.publishedFields = {};
|
||||
|
||||
/**
|
||||
* Specify which fields should be published by the posts.list publication
|
||||
* @summary Specify which fields should be published by the posts.list publication
|
||||
* @array Posts.publishedFields.list
|
||||
*/
|
||||
Posts.publishedFields.list = PublicationsUtils.arrayToFields([
|
||||
|
@ -26,7 +26,7 @@ Posts.publishedFields.list = PublicationsUtils.arrayToFields([
|
|||
]);
|
||||
|
||||
/**
|
||||
* Specify which fields should be published by the posts.single publication
|
||||
* @summary Specify which fields should be published by the posts.single publication
|
||||
* @array Posts.publishedFields.single
|
||||
*/
|
||||
Meteor.startup(() => {
|
||||
|
|
|
@ -3,7 +3,7 @@ Posts._ensureIndex({"status": 1, "postedAt": 1});
|
|||
// ------------------------------------- Helpers -------------------------------- //
|
||||
|
||||
/**
|
||||
* Get all users relevant to a list of posts
|
||||
* @summary Get all users relevant to a list of posts
|
||||
* (authors of the listed posts, and first four commenters of each post)
|
||||
* @param {Object} posts
|
||||
*/
|
||||
|
@ -24,7 +24,7 @@ const getPostsListUsers = posts => {
|
|||
};
|
||||
|
||||
/**
|
||||
* Get all users relevant to a single post
|
||||
* @summary Get all users relevant to a single post
|
||||
* (author of the current post, authors of its comments, and upvoters & downvoters of the post)
|
||||
* @param {Object} post
|
||||
*/
|
||||
|
@ -57,7 +57,7 @@ const getSinglePostUsers = post => {
|
|||
// ------------------------------------- Publications -------------------------------- //
|
||||
|
||||
/**
|
||||
* Publish a list of posts, along with the users corresponding to these posts
|
||||
* @summary Publish a list of posts, along with the users corresponding to these posts
|
||||
* @param {Object} terms
|
||||
*/
|
||||
Meteor.publish('posts.list', function (terms) {
|
||||
|
@ -85,7 +85,7 @@ Meteor.publish('posts.list', function (terms) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Publish a single post, along with all relevant users
|
||||
* @summary Publish a single post, along with all relevant users
|
||||
* @param {Object} terms
|
||||
*/
|
||||
Meteor.publish('posts.single', function (terms) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* Post views are filters used for subscribing to and viewing posts
|
||||
* @summary Post views are filters used for subscribing to and viewing posts
|
||||
* @namespace Posts.views
|
||||
*/
|
||||
Posts.views = {};
|
||||
|
||||
/**
|
||||
* Add a post view
|
||||
* @summary Add a post view
|
||||
* @param {string} viewName - The name of the view
|
||||
* @param {function} [viewFunction] - The function used to calculate query terms. Takes terms and baseParameters arguments
|
||||
*/
|
||||
|
@ -14,7 +14,7 @@ Posts.views.add = function (viewName, viewFunction) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Base parameters that will be common to all other view unless specific properties are overwritten
|
||||
* @summary Base parameters that will be common to all other view unless specific properties are overwritten
|
||||
*/
|
||||
Posts.views.baseParameters = {
|
||||
selector: {
|
||||
|
@ -26,7 +26,7 @@ Posts.views.baseParameters = {
|
|||
};
|
||||
|
||||
/**
|
||||
* Top view
|
||||
* @summary Top view
|
||||
*/
|
||||
Posts.views.add("top", function (terms) {
|
||||
return {
|
||||
|
@ -35,7 +35,7 @@ Posts.views.add("top", function (terms) {
|
|||
});
|
||||
|
||||
/**
|
||||
* New view
|
||||
* @summary New view
|
||||
*/
|
||||
Posts.views.add("new", function (terms) {
|
||||
return {
|
||||
|
@ -44,7 +44,7 @@ Posts.views.add("new", function (terms) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Best view
|
||||
* @summary Best view
|
||||
*/
|
||||
Posts.views.add("best", function (terms) {
|
||||
return {
|
||||
|
@ -53,7 +53,7 @@ Posts.views.add("best", function (terms) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Pending view
|
||||
* @summary Pending view
|
||||
*/
|
||||
Posts.views.add("pending", function (terms) {
|
||||
return {
|
||||
|
@ -66,7 +66,7 @@ Posts.views.add("pending", function (terms) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Rejected view
|
||||
* @summary Rejected view
|
||||
*/
|
||||
Posts.views.add("rejected", function (terms) {
|
||||
return {
|
||||
|
@ -79,7 +79,7 @@ Posts.views.add("rejected", function (terms) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Scheduled view
|
||||
* @summary Scheduled view
|
||||
*/
|
||||
Posts.views.add("scheduled", function (terms) {
|
||||
return {
|
||||
|
@ -90,7 +90,7 @@ Posts.views.add("scheduled", function (terms) {
|
|||
});
|
||||
|
||||
/**
|
||||
* User posts view
|
||||
* @summary User posts view
|
||||
*/
|
||||
Posts.views.add("userPosts", function (terms) {
|
||||
return {
|
||||
|
@ -100,7 +100,7 @@ Posts.views.add("userPosts", function (terms) {
|
|||
});
|
||||
|
||||
/**
|
||||
* User upvoted posts view
|
||||
* @summary User upvoted posts view
|
||||
*/
|
||||
Posts.views.add("userUpvotedPosts", function (terms) {
|
||||
var user = Meteor.users.findOne(terms.userId);
|
||||
|
@ -112,7 +112,7 @@ Posts.views.add("userUpvotedPosts", function (terms) {
|
|||
});
|
||||
|
||||
/**
|
||||
* User downvoted posts view
|
||||
* @summary User downvoted posts view
|
||||
*/
|
||||
Posts.views.add("userDownvotedPosts", function (terms) {
|
||||
var user = Meteor.users.findOne(terms.userId);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* The global namespace for Settings.
|
||||
* @summary The global namespace for Settings.
|
||||
* @namespace Telescope.settings.collection
|
||||
*/
|
||||
Telescope.settings.collection = new Mongo.Collection("settings");
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Generate HTML body from Markdown on user bio insert
|
||||
* @summary Generate HTML body from Markdown on user bio insert
|
||||
*/
|
||||
Users.after.insert(function (userId, user) {
|
||||
|
||||
|
@ -18,7 +18,7 @@ Users.after.insert(function (userId, user) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Generate HTML body from Markdown when user bio is updated
|
||||
* @summary Generate HTML body from Markdown when user bio is updated
|
||||
*/
|
||||
Users.before.update(function (userId, doc, fieldNames, modifier) {
|
||||
// if bio is being modified, update htmlBio too
|
||||
|
@ -28,7 +28,7 @@ Users.before.update(function (userId, doc, fieldNames, modifier) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Disallow $rename
|
||||
* @summary Disallow $rename
|
||||
*/
|
||||
Users.before.update(function (userId, doc, fieldNames, modifier) {
|
||||
if (!!modifier.$rename) {
|
||||
|
@ -37,7 +37,7 @@ Users.before.update(function (userId, doc, fieldNames, modifier) {
|
|||
});
|
||||
|
||||
/**
|
||||
* If user.telescope.email has changed, check for existing emails and change user.emails and email hash if needed
|
||||
* @summary If user.telescope.email has changed, check for existing emails and change user.emails and email hash if needed
|
||||
*/
|
||||
if (Meteor.isServer) {
|
||||
Users.before.update(function (userId, doc, fieldNames, modifier) {
|
||||
|
@ -73,7 +73,7 @@ Users.before.update(function (userId, doc, fieldNames, modifier) {
|
|||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Set up user object on creation
|
||||
* @summary Set up user object on creation
|
||||
* @param {Object} user – the user object being iterated on and returned
|
||||
* @param {Object} options – user options
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/**
|
||||
* Vote schema
|
||||
* @summary Vote schema
|
||||
* @type {SimpleSchema}
|
||||
*/
|
||||
Telescope.schemas.votes = new SimpleSchema({
|
||||
|
@ -18,7 +18,7 @@ Telescope.schemas.votes = new SimpleSchema({
|
|||
});
|
||||
|
||||
/**
|
||||
* User Data schema
|
||||
* @summary User Data schema
|
||||
* @type {SimpleSchema}
|
||||
*/
|
||||
Telescope.schemas.userData = new SimpleSchema({
|
||||
|
@ -187,7 +187,7 @@ Telescope.schemas.userData = new SimpleSchema({
|
|||
});
|
||||
|
||||
/**
|
||||
* Users schema
|
||||
* @summary Users schema
|
||||
* @type {SimpleSchema}
|
||||
*/
|
||||
Users.schema = new SimpleSchema({
|
||||
|
@ -252,7 +252,7 @@ Users.schema = new SimpleSchema({
|
|||
// });
|
||||
|
||||
/**
|
||||
* Attach schema to Meteor.users collection
|
||||
* @summary Attach schema to Meteor.users collection
|
||||
*/
|
||||
Users.attachSchema(Users.schema);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
////////////////////
|
||||
|
||||
/**
|
||||
* Get a user
|
||||
* @summary Get a user
|
||||
* @param {String} userOrUserId
|
||||
*/
|
||||
Users.getUser = function (userOrUserId) {
|
||||
|
@ -21,7 +21,7 @@ Users.getUser = function (userOrUserId) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Get a user's username (unique, no special characters or spaces)
|
||||
* @summary Get a user's username (unique, no special characters or spaces)
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.getUserName = function (user) {
|
||||
|
@ -40,7 +40,7 @@ Users.helpers({getUserName: function () {return Users.getUserName(this);}});
|
|||
Users.getUserNameById = function (userId) {return Users.getUserName(Meteor.users.findOne(userId))};
|
||||
|
||||
/**
|
||||
* Get a user's display name (not unique, can take special characters and spaces)
|
||||
* @summary Get a user's display name (not unique, can take special characters and spaces)
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.getDisplayName = function (user) {
|
||||
|
@ -54,7 +54,7 @@ Users.helpers({getDisplayName: function () {return Users.getDisplayName(this);}}
|
|||
Users.getDisplayNameById = function (userId) {return Users.getDisplayName(Meteor.users.findOne(userId));};
|
||||
|
||||
/**
|
||||
* Get a user's profile URL
|
||||
* @summary Get a user's profile URL
|
||||
* @param {Object} user (note: we only actually need either the _id or slug properties)
|
||||
* @param {Boolean} isAbsolute
|
||||
*/
|
||||
|
@ -73,7 +73,7 @@ Users.getProfileUrl = function (user, isAbsolute) {
|
|||
Users.helpers({getProfileUrl: function (isAbsolute) {return Users.getProfileUrl(this, isAbsolute);}});
|
||||
|
||||
/**
|
||||
* Get a user's Twitter name
|
||||
* @summary Get a user's Twitter name
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.getTwitterName = function (user) {
|
||||
|
@ -91,7 +91,7 @@ Users.helpers({getTwitterName: function () {return Users.getTwitterName(this);}}
|
|||
Users.getTwitterNameById = function (userId) {return Users.getTwitterName(Meteor.users.findOne(userId));};
|
||||
|
||||
/**
|
||||
* Get a user's GitHub name
|
||||
* @summary Get a user's GitHub name
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.getGitHubName = function (user) {
|
||||
|
@ -107,7 +107,7 @@ Users.helpers({getGitHubName: function () {return Users.getGitHubName(this);}});
|
|||
Users.getGitHubNameById = function (userId) {return Users.getGitHubName(Meteor.users.findOne(userId));};
|
||||
|
||||
/**
|
||||
* Get a user's email
|
||||
* @summary Get a user's email
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.getEmail = function (user) {
|
||||
|
@ -121,7 +121,7 @@ Users.helpers({getEmail: function () {return Users.getEmail(this);}});
|
|||
Users.getEmailById = function (userId) {return Users.getEmail(Meteor.users.findOne(userId));};
|
||||
|
||||
/**
|
||||
* Get a user's email hash
|
||||
* @summary Get a user's email hash
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.getEmailHash = function (user) {
|
||||
|
@ -132,7 +132,7 @@ Users.helpers({getEmailHash: function () {return Users.getEmailHash(this);}});
|
|||
Users.getEmailHashById = function (userId) {return Users.getEmailHash(Meteor.users.findOne(userId));};
|
||||
|
||||
/**
|
||||
* Check if a user's profile is complete
|
||||
* @summary Check if a user's profile is complete
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.userProfileComplete = function (user) {
|
||||
|
@ -147,7 +147,7 @@ Users.helpers({userProfileComplete: function () {return Users.userProfileComplet
|
|||
Users.userProfileCompleteById = function (userId) {return Users.userProfileComplete(Meteor.users.findOne(userId));};
|
||||
|
||||
/**
|
||||
* Get a user setting
|
||||
* @summary Get a user setting
|
||||
* @param {Object} user
|
||||
* @param {String} settingName
|
||||
* @param {Object} defaultValue
|
||||
|
@ -169,7 +169,7 @@ Users.getSetting = function (user, settingName, defaultValue) {
|
|||
Users.helpers({getSetting: function (settingName, defaultValue) {return Users.getSetting(this, settingName, defaultValue);}});
|
||||
|
||||
/**
|
||||
* Set a user setting
|
||||
* @summary Set a user setting
|
||||
* @param {Object} user
|
||||
* @param {String} settingName
|
||||
* @param {Object} defaultValue
|
||||
|
@ -182,7 +182,7 @@ Users.setSetting = function (user, settingName, value) {
|
|||
Users.helpers({setSetting: function () {return Users.setSetting(this);}});
|
||||
|
||||
/**
|
||||
* Check if a user has upvoted a post
|
||||
* @summary Check if a user has upvoted a post
|
||||
* @param {Object} user
|
||||
* @param {Object} post
|
||||
*/
|
||||
|
@ -192,7 +192,7 @@ Users.hasUpvoted = function (user, post) {
|
|||
Users.helpers({hasUpvoted: function (post) {return Users.hasUpvoted(this, post);}});
|
||||
|
||||
/**
|
||||
* Check if a user has downvoted a post
|
||||
* @summary Check if a user has downvoted a post
|
||||
* @param {Object} user
|
||||
* @param {Object} post
|
||||
*/
|
||||
|
@ -259,7 +259,7 @@ Users.findByEmail = function (email) {
|
|||
|
||||
|
||||
/**
|
||||
* @method Users.getRequiredFields
|
||||
* @summary @method Users.getRequiredFields
|
||||
* Get a list of all fields required for a profile to be complete.
|
||||
*/
|
||||
Users.getRequiredFields = function () {
|
||||
|
@ -272,7 +272,7 @@ Users.getRequiredFields = function () {
|
|||
};
|
||||
|
||||
/**
|
||||
* Check if the user has completed their profile.
|
||||
* @summary Check if the user has completed their profile.
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.hasCompletedProfile = function (user) {
|
||||
|
@ -284,7 +284,7 @@ Users.helpers({hasCompletedProfile: function () {return Users.hasCompletedProfil
|
|||
Users.hasCompletedProfileById = function (userId) {return Users.hasCompletedProfile(Meteor.users.findOne(userId));};
|
||||
|
||||
/**
|
||||
* Check if the user has upvoted an item before
|
||||
* @summary Check if the user has upvoted an item before
|
||||
* @param {Object} user
|
||||
* @param {Object} item
|
||||
*/
|
||||
|
@ -294,7 +294,7 @@ Users.hasUpvotedItem = function (user, item) {
|
|||
Users.helpers({hasUpvotedItem: function (item) {return Users.hasUpvotedItem(this, item);}});
|
||||
|
||||
/**
|
||||
* Check if the user has downvoted an item before
|
||||
* @summary Check if the user has downvoted an item before
|
||||
* @param {Object} user
|
||||
* @param {Object} item
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Telescope Users namespace
|
||||
* @summary Telescope Users namespace
|
||||
* @namespace Users
|
||||
*/
|
||||
Users = Meteor.users;
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
// because they'll throw an error when the user is undefined
|
||||
|
||||
/**
|
||||
* Telescope permissions
|
||||
* @summary Telescope permissions
|
||||
* @namespace Users.can
|
||||
*/
|
||||
Users.can = {};
|
||||
|
||||
/**
|
||||
* Check if a given user has access to view posts
|
||||
* @summary Check if a given user has access to view posts
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.can.view = function (user) {
|
||||
|
@ -26,7 +26,7 @@ Users.can.view = function (user) {
|
|||
Users.helpers({canView: function () {return Users.can.view(this);}});
|
||||
|
||||
/**
|
||||
* Check if a given user can view a specific post
|
||||
* @summary Check if a given user can view a specific post
|
||||
* @param {Object} user
|
||||
* @param {Object} post
|
||||
*/
|
||||
|
@ -40,7 +40,7 @@ Users.can.viewById = function (userId) {
|
|||
Users.helpers({canViewById: function () {return Users.can.viewById(this);}});
|
||||
|
||||
/**
|
||||
* Check if a given user can view a specific post
|
||||
* @summary Check if a given user can view a specific post
|
||||
* @param {Object} user - can be undefined!
|
||||
* @param {Object} post
|
||||
*/
|
||||
|
@ -69,7 +69,7 @@ Users.can.viewPost = function (user, post) {
|
|||
Users.helpers({canViewPost: function () {return Users.can.viewPost(this, post);}});
|
||||
|
||||
/**
|
||||
* Check if a given user has permission to submit new posts
|
||||
* @summary Check if a given user has permission to submit new posts
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.can.post = function (user) {
|
||||
|
@ -97,7 +97,7 @@ Users.can.post = function (user) {
|
|||
Users.helpers({canPost: function () {return Users.can.post(this);}});
|
||||
|
||||
/**
|
||||
* Check if a given user has permission to comment (same as posting for now)
|
||||
* @summary Check if a given user has permission to comment (same as posting for now)
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.can.comment = function (user) {
|
||||
|
@ -106,7 +106,7 @@ Users.can.comment = function (user) {
|
|||
Users.helpers({canComment: function () {return Users.can.comment(this);}});
|
||||
|
||||
/**
|
||||
* Check if a user has permission to vote (same as posting for now)
|
||||
* @summary Check if a user has permission to vote (same as posting for now)
|
||||
* @param {Object} user
|
||||
*/
|
||||
Users.can.vote = function (user) {
|
||||
|
@ -115,7 +115,7 @@ Users.can.vote = function (user) {
|
|||
Users.helpers({canVote: function () {return Users.can.vote(this);}});
|
||||
|
||||
/**
|
||||
* Check if a user can edit a document
|
||||
* @summary Check if a user can edit a document
|
||||
* @param {Object} user - The user performing the action
|
||||
* @param {Object} document - The document being edited
|
||||
*/
|
||||
|
@ -140,7 +140,7 @@ Users.can.editById = function (userId, document) {
|
|||
Users.helpers({canEditById: function (document) {return Users.can.editById(this, document);}});
|
||||
|
||||
/**
|
||||
* Check if a user can submit a field
|
||||
* @summary Check if a user can submit a field
|
||||
* @param {Object} user - The user performing the action
|
||||
* @param {Object} field - The field being edited or inserted
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@ import PublicationsUtils from 'meteor/utilities:smart-publications';
|
|||
Users.publishedFields = {};
|
||||
|
||||
/**
|
||||
* Specify which fields should be public
|
||||
* @summary Specify which fields should be public
|
||||
* @type {Array}
|
||||
*/
|
||||
Users.publishedFields.public = PublicationsUtils.arrayToFields([
|
||||
|
@ -15,7 +15,7 @@ Users.publishedFields.public = PublicationsUtils.arrayToFields([
|
|||
]);
|
||||
|
||||
/**
|
||||
* Minimum required properties to display avatars and display names
|
||||
* @summary Minimum required properties to display avatars and display names
|
||||
* @type {Array}
|
||||
*/
|
||||
// Users.publishedFields.list = PublicationsUtils.arrayToFields([
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* Telescope roles
|
||||
* @summary Telescope roles
|
||||
* @namespace Users.is
|
||||
*/
|
||||
Users.is = {};
|
||||
|
||||
/**
|
||||
* Check if a user is an admin
|
||||
* @summary Check if a user is an admin
|
||||
* @param {Object|string} userOrUserId - The user or their userId
|
||||
*/
|
||||
Users.is.admin = function (userOrUserId) {
|
||||
|
@ -21,7 +21,7 @@ Users.is.adminById = Users.is.admin;
|
|||
Users.helpers({_isAdmin: function () {return Users.is.admin(this);}});
|
||||
|
||||
/**
|
||||
* Check if a user owns a document
|
||||
* @summary Check if a user owns a document
|
||||
* @param {Object|string} userOrUserId - The user or their userId
|
||||
* @param {Object} document - The document to check (post, comment, user object, etc.)
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@ Users.is.ownerById = Users.is.owner;
|
|||
Users.helpers({isOwner: function () {return Users.is.owner(this, document);}});
|
||||
|
||||
/**
|
||||
* Check if a user is a member or an admin
|
||||
* @summary Check if a user is a member or an admin
|
||||
* @param {Object} user - The user
|
||||
* @param {Object} document - The document to check (post, comment, user object, etc.)
|
||||
*/
|
||||
|
@ -56,7 +56,7 @@ Users.is.memberOrAdmin = function (user) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Check if a user owns a document or is an admin
|
||||
* @summary Check if a user owns a document or is an admin
|
||||
* @param {Object} user - The user
|
||||
* @param {Object} document - The document to check (post, comment, user object, etc.)
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Publish a single user
|
||||
* @summary Publish a single user
|
||||
* @param {String} idOrSlug
|
||||
*/
|
||||
Meteor.publish('users.single', function (terms) {
|
||||
|
@ -15,7 +15,7 @@ Meteor.publish('users.single', function (terms) {
|
|||
});
|
||||
|
||||
/**
|
||||
* Publish the current user
|
||||
* @summary Publish the current user
|
||||
*/
|
||||
Meteor.publish('users.current', function () {
|
||||
const user = Meteor.users.find({_id: this.userId}, {fields: {'services.password.bcrypt': false}});
|
||||
|
|
Loading…
Add table
Reference in a new issue