eslint & clean up code, also fixed some bugs (#1515)

* [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
This commit is contained in:
Comus Leong 2016-11-26 02:46:55 +08:00 committed by Xavier Cazalot
parent 99c8d6ef34
commit 464e20a96c
102 changed files with 548 additions and 457 deletions

1
.eslintignore Normal file
View file

@ -0,0 +1 @@
packages/_*

View file

@ -1,6 +1,8 @@
{ {
"extends": [ "extends": [
"eslint:recommended" "eslint:recommended",
"plugin:meteor/recommended",
"plugin:react/recommended"
], ],
"parser": "babel-eslint", "parser": "babel-eslint",
"parserOptions": { "parserOptions": {
@ -10,7 +12,17 @@
}, },
"rules": { "rules": {
"babel/generator-star-spacing": 0, "babel/generator-star-spacing": 0,
"babel/new-cap": 1, "babel/new-cap": [1, {
"capIsNewExceptions": [
"Optional",
"OneOf",
"Maybe",
"MailChimpAPI",
"Juice",
"Run",
"AppComposer"
]
}],
"babel/array-bracket-spacing": 0, "babel/array-bracket-spacing": 0,
"babel/object-curly-spacing": 0, "babel/object-curly-spacing": 0,
"babel/object-shorthand": 0, "babel/object-shorthand": 0,
@ -20,8 +32,14 @@
"key-spacing": 0, "key-spacing": 0,
"no-extra-boolean-cast": 0, "no-extra-boolean-cast": 0,
"no-undef": 1, "no-undef": 1,
"no-unused-vars": 1, "no-unused-vars": [1, {
"no-console": 1 "vars": "all",
"args": "none",
"varsIgnorePattern": "React|PropTypes|Component"
}],
"no-console": 1,
"react/prop-types": 0,
"meteor/audit-argument-checks": 0
}, },
"env": { "env": {
"browser": true, "browser": true,
@ -32,7 +50,8 @@
}, },
"plugins": [ "plugins": [
"babel", "babel",
"meteor" "meteor",
"react"
], ],
"settings": { "settings": {
"import/resolver": "meteor" "import/resolver": "meteor"

View file

@ -9,7 +9,7 @@ functions, event handlers, etc.).
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { FormattedMessage, intlShape } from 'react-intl'; import { FormattedMessage /*, intlShape */ } from 'react-intl';
class CustomNewsletter extends Telescope.components.Newsletter { class CustomNewsletter extends Telescope.components.Newsletter {

View file

@ -1,12 +1,12 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Posts from "meteor/nova:posts";
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { FormattedMessage, FormattedRelative } from 'react-intl'; import { FormattedMessage, FormattedRelative } from 'react-intl';
import { Button } from 'react-bootstrap';
import moment from 'moment';
import { ModalTrigger } from "meteor/nova:core";
import { Link } from 'react-router'; import { Link } from 'react-router';
import Posts from "meteor/nova:posts"; // import { Button } from 'react-bootstrap';
import Categories from "meteor/nova:categories"; // import moment from 'moment';
// import { ModalTrigger } from "meteor/nova:core";
// import Categories from "meteor/nova:categories";
class CustomPostsItem extends Telescope.components.PostsItem { class CustomPostsItem extends Telescope.components.PostsItem {
@ -61,7 +61,7 @@ class CustomPostsItem extends Telescope.components.PostsItem {
</div> </div>
) )
} }
}; }
CustomPostsItem.propTypes = { CustomPostsItem.propTypes = {
post: React.PropTypes.object.isRequired post: React.PropTypes.object.isRequired

View file

@ -1,3 +1,4 @@
import { Picker } from 'meteor/meteorhacks:picker';
import { servePostsApi } from './api.js'; import { servePostsApi } from './api.js';
// for backwards compatibility's sake, accept a "limit" segment // for backwards compatibility's sake, accept a "limit" segment

View file

@ -1,9 +1,9 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import NovaForm from "meteor/nova:forms";
import Categories from "meteor/nova:categories";
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import NovaForm from "meteor/nova:forms"; // import { DocumentContainer } from "meteor/utilities:react-list-container";
import { DocumentContainer } from "meteor/utilities:react-list-container";
import Categories from "meteor/nova:categories";
class CategoriesEditForm extends Component{ class CategoriesEditForm extends Component{

View file

@ -1,11 +1,11 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import { /* ModalTrigger, */ ContextPasser } from "meteor/nova:core";
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { Button, DropdownButton, MenuItem, Modal } from 'react-bootstrap'; import { Button, DropdownButton, MenuItem, Modal } from 'react-bootstrap';
import { /* ModalTrigger, */ ContextPasser } from "meteor/nova:core";
import { withRouter } from 'react-router' import { withRouter } from 'react-router'
import { LinkContainer } from 'react-router-bootstrap'; import { LinkContainer } from 'react-router-bootstrap';
import Users from 'meteor/nova:users'; // import Users from 'meteor/nova:users';
// note: cannot use ModalTrigger component because of https://github.com/react-bootstrap/react-bootstrap/issues/1808 // note: cannot use ModalTrigger component because of https://github.com/react-bootstrap/react-bootstrap/issues/1808
@ -84,7 +84,7 @@ class CategoriesList extends Component {
render() { render() {
const categories = this.props.categories; const categories = this.props.categories;
const context = this.context; // const context = this.context;
const currentQuery = _.clone(this.props.router.location.query); const currentQuery = _.clone(this.props.router.location.query);
delete currentQuery.cat; delete currentQuery.cat;
@ -115,7 +115,7 @@ class CategoriesList extends Component {
) )
} }
}; }
CategoriesList.propTypes = { CategoriesList.propTypes = {
categories: React.PropTypes.array categories: React.PropTypes.array

View file

@ -1,11 +1,11 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Users from 'meteor/nova:users';
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { Button, DropdownButton, MenuItem } from 'react-bootstrap';
import classNames from "classnames";
//import { Messages, ModalTrigger } from 'meteor/nova:core';
import { LinkContainer } from 'react-router-bootstrap'; import { LinkContainer } from 'react-router-bootstrap';
import { withRouter } from 'react-router' import { withRouter } from 'react-router'
import Users from 'meteor/nova:users'; import { /* Button, DropdownButton, */ MenuItem } from 'react-bootstrap';
// import classNames from "classnames";
// import { Messages, ModalTrigger } from 'meteor/nova:core';
class Category extends Component { class Category extends Component {
@ -26,7 +26,7 @@ class Category extends Component {
const {category, index, router} = this.props; const {category, index, router} = this.props;
const currentQuery = router.location.query; // const currentQuery = router.location.query;
const currentCategorySlug = router.location.query.cat; const currentCategorySlug = router.location.query.cat;
const newQuery = _.clone(router.location.query); const newQuery = _.clone(router.location.query);
newQuery.cat = category.slug; newQuery.cat = category.slug;

View file

@ -1,8 +1,8 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import moment from 'moment';
import { intlShape, FormattedMessage, FormattedRelative } from 'react-intl'; import { intlShape, FormattedMessage, FormattedRelative } from 'react-intl';
import Users from 'meteor/nova:users'; // import moment from 'moment';
// import Users from 'meteor/nova:users';
class CommentsItem extends Component{ class CommentsItem extends Component{

View file

@ -1,6 +1,6 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React from 'react'; import React from 'react';
import {injectIntl, FormattedMessage} from 'react-intl'; import {/* injectIntl, */ FormattedMessage} from 'react-intl';
const CommentsList = ({results, hasMore, ready, count, totalCount, loadMore}) => { const CommentsList = ({results, hasMore, ready, count, totalCount, loadMore}) => {

View file

@ -30,7 +30,7 @@ class CommentsNew extends Component {
) )
} }
}; }
CommentsNew.propTypes = { CommentsNew.propTypes = {
postId: React.PropTypes.string.isRequired, postId: React.PropTypes.string.isRequired,

View file

@ -31,7 +31,7 @@ class CommentsNode extends Component {
) )
} }
}; }
CommentsNode.propTypes = { CommentsNode.propTypes = {
comment: React.PropTypes.object.isRequired, // the current comment comment: React.PropTypes.object.isRequired, // the current comment

View file

@ -29,7 +29,7 @@ class Newsletter extends Component {
subscribeEmail(data) { subscribeEmail(data) {
this.context.actions.call("newsletter.addEmail", data.email, (error, result) => { this.context.actions.call("newsletter.addEmail", data.email, (error, result) => {
if (error) { if (error) {
console.log(error); console.log(error); // eslint-disable-line
this.context.messages.flash(error.message, "error"); this.context.messages.flash(error.message, "error");
} else { } else {
this.successCallbackSubscription(result); this.successCallbackSubscription(result);

View file

@ -1,7 +1,7 @@
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { Button } from 'react-bootstrap'; import { Button } from 'react-bootstrap';
import { Messages } from 'meteor/nova:core'; // import { Messages } from 'meteor/nova:core';
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
class NewsletterButton extends Component { class NewsletterButton extends Component {
@ -15,7 +15,7 @@ class NewsletterButton extends Component {
'newsletter.removeUser' : 'newsletter.addUser'; 'newsletter.removeUser' : 'newsletter.addUser';
this.context.actions.call(action, this.props.user, (error, result) => { this.context.actions.call(action, this.props.user, (error, result) => {
if (error) { if (error) {
console.log(error); console.log(error); // eslint-disable-line
this.context.messages.flash(error.message, "error"); this.context.messages.flash(error.message, "error");
} else { } else {
this.props.successCallback(result); this.props.successCallback(result);

View file

@ -1,5 +1,6 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
import { T9n } from 'meteor/softwarerero:accounts-t9n';
// import { checkNpmVersions } from 'meteor/tmeasday:check-npm-versions'; // import { checkNpmVersions } from 'meteor/tmeasday:check-npm-versions';
// checkNpmVersions({ // checkNpmVersions({

View file

@ -1,6 +1,6 @@
import Telescope from "meteor/nova:lib"; import Telescope from "meteor/nova:lib";
import React, { PropTypes, Component } from "react"; import React, { PropTypes, Component } from "react";
import { Button } from "react-bootstrap"; // import { Button } from "react-bootstrap";
import moment from "moment"; import moment from "moment";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";

View file

@ -1,8 +1,8 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react';
import { ListContainer } from "meteor/utilities:react-list-container";
import moment from 'moment';
import Posts from "meteor/nova:posts"; import Posts from "meteor/nova:posts";
import { ListContainer } from "meteor/utilities:react-list-container";
import React, { PropTypes, Component } from 'react';
import moment from 'moment';
class PostsDay extends Component { class PostsDay extends Component {
@ -19,7 +19,7 @@ class PostsDay extends Component {
listId: `posts.list.${moment(date).format("YYYY-MM-DD")}` listId: `posts.list.${moment(date).format("YYYY-MM-DD")}`
}; };
({selector, options} = Posts.parameters.get(terms)); const {selector, options} = Posts.parameters.get(terms);
const postsPerPage = Telescope.settings.get("postsPerPage", 10); const postsPerPage = Telescope.settings.get("postsPerPage", 10);

View file

@ -1,12 +1,12 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react';
import { FormattedMessage, intlShape } from 'react-intl';
import NovaForm from "meteor/nova:forms"; import NovaForm from "meteor/nova:forms";
import { DocumentContainer } from "meteor/utilities:react-list-container"; import { DocumentContainer } from "meteor/utilities:react-list-container";
//import { Messages } from "meteor/nova:core";
//import Actions from "../actions.js";
import Posts from "meteor/nova:posts"; import Posts from "meteor/nova:posts";
import Users from 'meteor/nova:users'; import React, { PropTypes, Component } from 'react';
import { FormattedMessage, intlShape } from 'react-intl';
// import { Messages } from "meteor/nova:core";
// import Actions from "../actions.js";
// import Users from 'meteor/nova:users';
class PostsEditForm extends Component{ class PostsEditForm extends Component{

View file

@ -1,6 +1,6 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { ListContainer, DocumentContainer } from "meteor/utilities:react-list-container"; import { ListContainer /* , DocumentContainer */ } from "meteor/utilities:react-list-container";
import Posts from "meteor/nova:posts"; import Posts from "meteor/nova:posts";
class PostsHome extends Component { class PostsHome extends Component {
@ -29,6 +29,6 @@ class PostsHome extends Component {
/> />
) )
} }
}; }
module.exports = PostsHome; module.exports = PostsHome;

View file

@ -1,12 +1,12 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import { ModalTrigger } from "meteor/nova:core";
import Posts from "meteor/nova:posts";
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { FormattedMessage, FormattedRelative } from 'react-intl'; import { FormattedMessage, FormattedRelative } from 'react-intl';
import { Button } from 'react-bootstrap';
import moment from 'moment';
import { ModalTrigger } from "meteor/nova:core";
import { Link } from 'react-router'; import { Link } from 'react-router';
import Posts from "meteor/nova:posts"; // import { Button } from 'react-bootstrap';
import Users from 'meteor/nova:users'; // import moment from 'moment';
// import Users from 'meteor/nova:users';
class PostsItem extends Component { class PostsItem extends Component {
@ -81,7 +81,7 @@ class PostsItem extends Component {
</div> </div>
) )
} }
}; }
PostsItem.propTypes = { PostsItem.propTypes = {
post: React.PropTypes.object.isRequired post: React.PropTypes.object.isRequired

View file

@ -1,6 +1,6 @@
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { FormattedMessage, intlShape } from 'react-intl'; import { FormattedMessage, intlShape } from 'react-intl';
import { Button, ButtonGroup, DropdownButton, MenuItem } from 'react-bootstrap'; import { /* Button, ButtonGroup, */ DropdownButton, MenuItem } from 'react-bootstrap';
import { LinkContainer } from 'react-router-bootstrap'; import { LinkContainer } from 'react-router-bootstrap';
import { withRouter } from 'react-router' import { withRouter } from 'react-router'
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';

View file

@ -23,12 +23,12 @@ class AccountsButton extends Accounts.ui.Button {
render () { render () {
const {label, href, type, disabled, className, onClick} = this.props; const {label, href, type, disabled, className, onClick} = this.props;
if (type === 'link') { if (type === 'link') {
return <a href={ href } className={ className } onClick={ onClick }>{ label }</a>; return <a href={ href } className={ className } onClick={ onClick }>{ label }</a>;
} }
return <Button return <Button
bsStyle="primary" bsStyle="primary"
className={ className } className={ className }
type={ type }  type={ type }
disabled={ disabled } disabled={ disabled }
onClick={ onClick }>{ label } onClick={ onClick }>{ label }
</Button>; </Button>;
@ -46,11 +46,11 @@ class AccountsField extends Accounts.ui.Field {
} }
render() { render() {
const { id, hint, label, type = 'text', onChange, className = "field", defaultValue = "" } = this.props; const { id, hint, /* label, */ type = 'text', onChange, className = "field", defaultValue = "" } = this.props;
const { mount = true } = this.state; const { mount = true } = this.state;
return mount ? ( return mount ? (
<div className={ className }> <div className={ className }>
<FormControl id={ id } type={ type } onChange={ onChange } placeholder={ hint } defaultValue={ defaultValue } /> <FormControl id={ id } type={ type } onChange={ onChange } placeholder={ hint } defaultValue={ defaultValue } />
</div> </div>
) : null; ) : null;
} }

View file

@ -1,7 +1,7 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { Dropdown, Button } from 'react-bootstrap'; import { Dropdown /* , Button */ } from 'react-bootstrap';
const UsersAccountMenu = () => { const UsersAccountMenu = () => {

View file

@ -1,7 +1,7 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { FormattedMessage, intlShape } from 'react-intl'; import { FormattedMessage, intlShape } from 'react-intl';
import { Row, Col } from 'react-bootstrap'; // import { Row, Col } from 'react-bootstrap';
import NovaForm from "meteor/nova:forms"; import NovaForm from "meteor/nova:forms";
//import { Messages } from "meteor/nova:core"; //import { Messages } from "meteor/nova:core";
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
@ -9,7 +9,7 @@ import Users from 'meteor/nova:users';
const UsersEdit = (props, context) => { const UsersEdit = (props, context) => {
const user = props.user; const user = props.user;
const currentUser = props.currentUser; // const currentUser = props.currentUser;
//const label = `Edit profile for ${Users.getDisplayName(user)}`; //const label = `Edit profile for ${Users.getDisplayName(user)}`;

View file

@ -1,5 +1,6 @@
import React, { Component } from 'react';
import { Accounts, STATES } from 'meteor/std:accounts-ui'; import { Accounts, STATES } from 'meteor/std:accounts-ui';
import { T9n } from 'meteor/softwarerero:accounts-t9n';
import React, { Component } from 'react';
import { Link } from 'react-router'; import { Link } from 'react-router';
class UsersResetPassword extends Component { class UsersResetPassword extends Component {

View file

@ -1,16 +1,16 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React from 'react';
import {mount} from 'react-mounter';
import { Messages } from 'meteor/nova:core'; import { Messages } from 'meteor/nova:core';
import { IndexRoute, Route, useRouterHistory, browserHistory, createMemoryHistory } from 'react-router';
import { ReactRouterSSR } from 'meteor/reactrouter:react-router-ssr';
import { ListContainer, DocumentContainer } from "meteor/utilities:react-list-container";
// import useNamedRoutes from 'use-named-routes';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import Events from "meteor/nova:events"; import Events from "meteor/nova:events";
import { ReactRouterSSR } from 'meteor/reactrouter:react-router-ssr';
import React from 'react';
import Helmet from 'react-helmet'; import Helmet from 'react-helmet';
import Cookie from 'react-cookie'; import Cookie from 'react-cookie';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
// import {mount} from 'react-mounter';
// import { IndexRoute, Route, useRouterHistory, browserHistory, createMemoryHistory } from 'react-router';
// import { ListContainer, DocumentContainer } from "meteor/utilities:react-list-container";
// import useNamedRoutes from 'use-named-routes';
// import createBrowserHistory from 'history/lib/createBrowserHistory';
Telescope.routes.indexRoute = { name: "posts.list", component: Telescope.components.PostsHome }; Telescope.routes.indexRoute = { name: "posts.list", component: Telescope.components.PostsHome };
@ -33,7 +33,7 @@ Meteor.startup(() => {
childRoutes: Telescope.routes.routes childRoutes: Telescope.routes.routes
} }
let history; // let history;
const clientOptions = { const clientOptions = {
renderHook: ReactDOM.render, renderHook: ReactDOM.render,

View file

@ -18,7 +18,8 @@ Categories.getParents = function (category) {
categoriesArray.push(parent); categoriesArray.push(parent);
recurse(parent); recurse(parent);
} }
}(category); };
getParents(category);
return categoriesArray; return categoriesArray;
}; };
@ -37,7 +38,8 @@ Categories.getChildren = function (category) {
categoriesArray = categoriesArray.concat(children); categoriesArray = categoriesArray.concat(children);
recurse(children); recurse(children);
} }
}([category]); };
getChildren([category]);
return categoriesArray; return categoriesArray;
}; };

View file

@ -1,6 +1,7 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Categories from "./collection.js"; import Categories from "./collection.js";
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
const canInsert = user => Users.canDo(user, "categories.new"); const canInsert = user => Users.canDo(user, "categories.new");
const canEdit = user => Users.canDo(user, "categories.edit.all"); const canEdit = user => Users.canDo(user, "categories.edit.all");

View file

@ -19,7 +19,7 @@ if (Meteor.settings && Meteor.settings.categories) {
} else { } else {
// if not, create it // if not, create it
Categories.insert(category); Categories.insert(category);
console.log(`// Creating category “${category.name}`); console.log(`// Creating category “${category.name}`); // eslint-disable-line
} }
}); });
} }

View file

@ -1,4 +1,4 @@
import Posts from "meteor/nova:posts"; // import Posts from "meteor/nova:posts";
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
import Categories from "../collection.js"; import Categories from "../collection.js";
@ -9,6 +9,8 @@ Meteor.publish('categories', function() {
if(Users.canDo(currentUser, "posts.view.approved.all")){ if(Users.canDo(currentUser, "posts.view.approved.all")){
var categories = Categories.find({}, {fields: Categories.publishedFields.list}); var categories = Categories.find({}, {fields: Categories.publishedFields.list});
/*
var publication = this; var publication = this;
categories.forEach(function (category) { categories.forEach(function (category) {
@ -17,6 +19,7 @@ Meteor.publish('categories', function() {
var cursor = Posts.find({$and: [{categories: {$in: categoryIds}}, {status: Posts.config.STATUS_APPROVED}]}); var cursor = Posts.find({$and: [{categories: {$in: categoryIds}}, {status: Posts.config.STATUS_APPROVED}]});
// Counts.publish(publication, category.getCounterName(), cursor, { noReady: true }); // Counts.publish(publication, category.getCounterName(), cursor, { noReady: true });
}); });
*/
return categories; return categories;
} }

View file

@ -1,3 +1,4 @@
import Telescope from 'meteor/nova:lib';
import Posts from "meteor/nova:posts"; import Posts from "meteor/nova:posts";
import PublicationUtils from 'meteor/utilities:smart-publications'; import PublicationUtils from 'meteor/utilities:smart-publications';
@ -20,7 +21,7 @@ Posts.addField([
]); ]);
if (typeof Settings !== "undefined") { if (typeof Settings !== "undefined") {
Settings.addField([ Telescope.settings.collection.addField([
{ {
fieldName: 'cloudinaryCloudName', fieldName: 'cloudinaryCloudName',
fieldSchema: { fieldSchema: {

View file

@ -26,8 +26,8 @@ const CloudinaryUtils = {
}; };
return data; return data;
} catch (error) { } catch (error) {
console.log("// Cloudinary upload failed for URL: "+imageUrl); console.log("// Cloudinary upload failed for URL: "+imageUrl); // eslint-disable-line
console.log(error.stack); console.log(error.stack); // eslint-disable-line
} }
}, },
@ -56,7 +56,7 @@ Meteor.methods({
if (Users.isAdmin(Meteor.user())) { if (Users.isAdmin(Meteor.user())) {
thumbnailUrl = typeof thumbnailUrl === "undefined" ? "http://www.telescopeapp.org/images/logo.png" : thumbnailUrl; thumbnailUrl = typeof thumbnailUrl === "undefined" ? "http://www.telescopeapp.org/images/logo.png" : thumbnailUrl;
const data = CloudinaryUtils.uploadImage(thumbnailUrl); const data = CloudinaryUtils.uploadImage(thumbnailUrl);
console.log(data); console.log(data); // eslint-disable-line
} }
}, },
cachePostThumbnails: function (limit = 20) { cachePostThumbnails: function (limit = 20) {
@ -71,7 +71,7 @@ Meteor.methods({
postsWithUncachedThumbnails.forEach(Meteor.bindEnvironment((post, index) => { postsWithUncachedThumbnails.forEach(Meteor.bindEnvironment((post, index) => {
Meteor.setTimeout(function () { Meteor.setTimeout(function () {
console.log(`// ${index}. Caching thumbnail for post “${post.title}” (_id: ${post._id})`); console.log(`// ${index}. Caching thumbnail for post “${post.title}” (_id: ${post._id})`); // eslint-disable-line
const data = CloudinaryUtils.uploadImage(post.thumbnailUrl); const data = CloudinaryUtils.uploadImage(post.thumbnailUrl);
Posts.update(post._id, {$set:{ Posts.update(post._id, {$set:{

View file

@ -278,7 +278,7 @@ Telescope.callbacks.add("comments.edit.method", CommentsEditSubmittedPropertiesC
function UsersRemoveDeleteComments (user, options) { function UsersRemoveDeleteComments (user, options) {
if (options && options.deleteComments) { if (options && options.deleteComments) {
Comments.remove({userId: userId}); Comments.remove({userId: user._id});
} else { } else {
// not sure if anything should be done in that scenario yet // not sure if anything should be done in that scenario yet
// Comments.update({userId: userId}, {$set: {author: "\[deleted\]"}}, {multi: true}); // Comments.update({userId: userId}, {$set: {author: "\[deleted\]"}}, {multi: true});

View file

@ -2,6 +2,6 @@
* @summary The global namespace for Comments. * @summary The global namespace for Comments.
* @namespace Comments * @namespace Comments
*/ */
Comments = new Mongo.Collection("comments"); const Comments = new Mongo.Collection("comments");
export default Comments; export default Comments;

View file

@ -1,6 +1,6 @@
import PublicationUtils from 'meteor/utilities:smart-publications'; import PublicationUtils from 'meteor/utilities:smart-publications';
import Posts from "meteor/nova:posts"; import Posts from 'meteor/nova:posts';
import Users from "meteor/nova:users"; import Users from 'meteor/nova:users';
Posts.addField([ Posts.addField([
/** /**

View file

@ -1,4 +1,4 @@
import Telescope from 'meteor/nova:lib'; // import Telescope from 'meteor/nova:lib';
import Comments from './collection.js'; import Comments from './collection.js';
import Posts from 'meteor/nova:posts'; import Posts from 'meteor/nova:posts';
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';

View file

@ -1,6 +1,6 @@
import Comments from './collection.js'; import Comments from './collection.js';
import PublicationsUtils from 'meteor/utilities:smart-publications'; import PublicationsUtils from 'meteor/utilities:smart-publications';
import Posts from "meteor/nova:posts"; // import Posts from "meteor/nova:posts";
Comments.publishedFields = {}; Comments.publishedFields = {};

View file

@ -1,7 +1,7 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Comments from './collection.js';
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import Comments from './collection.js';
// check if user can create a new comment // check if user can create a new comment
const canInsert = user => Users.canDo(user, "comments.new"); const canInsert = user => Users.canDo(user, "comments.new");
@ -10,7 +10,7 @@ const canInsert = user => Users.canDo(user, "comments.new");
const canEdit = Users.canEdit; const canEdit = Users.canEdit;
// check if user can edit *all* comments // check if user can edit *all* comments
const canEditAll = user => Users.canDo(user, "comments.edit.all"); // const canEditAll = user => Users.canDo(user, "comments.edit.all");
/** /**
* @summary Comments schema * @summary Comments schema

View file

@ -1,5 +1,6 @@
import Posts from "meteor/nova:posts"; import Posts from "meteor/nova:posts";
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
import Comments from '../collection.js';
Comments._ensureIndex({postId: 1}); Comments._ensureIndex({postId: 1});
Comments._ensureIndex({parentCommentId: 1}); Comments._ensureIndex({parentCommentId: 1});
@ -13,7 +14,7 @@ Meteor.publish('comments.list', function (terms) {
const currentUser = this.userId && Users.findOne(this.userId); const currentUser = this.userId && Users.findOne(this.userId);
terms.currentUserId = this.userId; // add currentUserId to terms terms.currentUserId = this.userId; // add currentUserId to terms
({selector, options} = Comments.parameters.get(terms)); const {selector, options} = Comments.parameters.get(terms);
// commenting this because of FR-SSR issue // commenting this because of FR-SSR issue
// Counts.publish(this, 'comments.list', Comments.find(selector, options)); // Counts.publish(this, 'comments.list', Comments.find(selector, options));

View file

@ -1,4 +1,4 @@
import Telescope from 'meteor/nova:lib'; // import Telescope from 'meteor/nova:lib';
/** /**
* @summary Update an item's (post or comment) score * @summary Update an item's (post or comment) score
@ -7,6 +7,8 @@ import Telescope from 'meteor/nova:lib';
* @param {object} collection - The collection the item belongs to * @param {object} collection - The collection the item belongs to
* @param {string} operation - The operation being performed * @param {string} operation - The operation being performed
*/ */
/*
function updateScore (item, user, collection, operation) { function updateScore (item, user, collection, operation) {
Telescope.updateScore({collection: collection, item: item, forceUpdate: true}); Telescope.updateScore({collection: collection, item: item, forceUpdate: true});
} }
@ -14,6 +16,7 @@ Telescope.callbacks.add("upvote.async", updateScore);
Telescope.callbacks.add("downvote.async", updateScore); Telescope.callbacks.add("downvote.async", updateScore);
Telescope.callbacks.add("cancelUpvote.async", updateScore); Telescope.callbacks.add("cancelUpvote.async", updateScore);
Telescope.callbacks.add("cancelDownvote.async", updateScore); Telescope.callbacks.add("cancelDownvote.async", updateScore);
*/
/** /**
* @summary Update the profile of the user doing the operation * @summary Update the profile of the user doing the operation
@ -22,6 +25,8 @@ Telescope.callbacks.add("cancelDownvote.async", updateScore);
* @param {object} collection - The collection the item belongs to * @param {object} collection - The collection the item belongs to
* @param {string} operation - The operation being performed * @param {string} operation - The operation being performed
*/ */
/*
function updateUser (item, user, collection, operation) { function updateUser (item, user, collection, operation) {
var update = {}; var update = {};
@ -54,6 +59,7 @@ Telescope.callbacks.add("upvote.async", updateUser);
Telescope.callbacks.add("downvote.async", updateUser); Telescope.callbacks.add("downvote.async", updateUser);
Telescope.callbacks.add("cancelUpvote.async", updateUser); Telescope.callbacks.add("cancelUpvote.async", updateUser);
Telescope.callbacks.add("cancelDownvote.async", updateUser); Telescope.callbacks.add("cancelDownvote.async", updateUser);
*/
/** /**
* @summary Update the karma of the item's owner * @summary Update the karma of the item's owner
@ -62,6 +68,8 @@ Telescope.callbacks.add("cancelDownvote.async", updateUser);
* @param {object} collection - The collection the item belongs to * @param {object} collection - The collection the item belongs to
* @param {string} operation - The operation being performed * @param {string} operation - The operation being performed
*/ */
/*
function updateKarma (item, user, collection, operation) { function updateKarma (item, user, collection, operation) {
var votePower = Telescope.getVotePower(user); var votePower = Telescope.getVotePower(user);
@ -77,3 +85,4 @@ Telescope.callbacks.add("upvote.async", updateKarma);
Telescope.callbacks.add("downvote.async", updateKarma); Telescope.callbacks.add("downvote.async", updateKarma);
Telescope.callbacks.add("cancelUpvote.async", updateKarma); Telescope.callbacks.add("cancelUpvote.async", updateKarma);
Telescope.callbacks.add("cancelDownvote.async", updateKarma); Telescope.callbacks.add("cancelDownvote.async", updateKarma);
*/

View file

@ -62,7 +62,7 @@ class ModalTrigger extends Component {
</div> </div>
) )
} }
}; }
ModalTrigger.propTypes = { ModalTrigger.propTypes = {
component: React.PropTypes.object.isRequired, component: React.PropTypes.object.isRequired,

View file

@ -1,6 +1,7 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import {Inject} from 'meteor/meteorhacks:inject-initial';
import Events from "meteor/nova:events"; import Events from "meteor/nova:events";
import { Inject } from 'meteor/meteorhacks:inject-initial';
import { SyncedCron } from 'meteor/percolatestudio:synced-cron';
Meteor.startup(function () { Meteor.startup(function () {
Events.log({ Events.log({

View file

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import Posts from "meteor/nova:posts"; // import Posts from "meteor/nova:posts";
import Comments from "meteor/nova:comments"; // import Comments from "meteor/nova:comments";
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
const Group = ({name, actions}) => { const Group = ({name, actions}) => {

View file

@ -1,3 +1,5 @@
/* eslint-disable no-undef */
import TelescopeImport from 'meteor/nova:lib'; import TelescopeImport from 'meteor/nova:lib';
import PostsImport from "meteor/nova:posts"; import PostsImport from "meteor/nova:posts";
import CommentsImport from "meteor/nova:comments"; import CommentsImport from "meteor/nova:comments";

View file

@ -9,7 +9,7 @@ Meteor.methods({
if(Users.isAdminById(this.userId)){ if(Users.isAdminById(this.userId)){
console.log("// testing email ["+emailName+"]"); console.log("// testing email ["+emailName+"]"); // eslint-disable-line
let html, properties; let html, properties;
// if email has a custom way of generating its HTML, use it // if email has a custom way of generating its HTML, use it

View file

@ -1,10 +1,13 @@
/* global Movies:true */
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react';
import {mount} from 'react-mounter';
import MoviesWrapper from './demo-components.jsx';
import Core from 'meteor/nova:core';
import { Route } from 'react-router';
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import React, { PropTypes, Component } from 'react';
import MoviesWrapper from './demo-components.jsx';
// import {mount} from 'react-mounter';
// import Core from 'meteor/nova:core';
// import { Route } from 'react-router';
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Collection & Schema // // Collection & Schema //

View file

@ -1,10 +1,12 @@
/* global Movies */
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { ListContainer } from "meteor/utilities:react-list-container"; import { ListContainer } from "meteor/utilities:react-list-container";
import NovaForm from "meteor/nova:forms"; import NovaForm from "meteor/nova:forms";
import { Button } from 'react-bootstrap'; import { Button } from 'react-bootstrap';
import { Accounts } from 'meteor/std:accounts-ui'; import { Accounts } from 'meteor/std:accounts-ui';
import { ModalTrigger, Messages, FlashContainer } from "meteor/nova:core"; import { ModalTrigger, /* Messages, */ FlashContainer } from "meteor/nova:core";
const FlashMessages = Telescope.components.FlashMessages; const FlashMessages = Telescope.components.FlashMessages;
@ -78,7 +80,7 @@ class MoviesList extends Component {
</div> </div>
) )
} }
}; }
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Movie // // Movie //
@ -124,7 +126,7 @@ class Movie extends Component {
) )
} }
}; }
const LoadMore = props => <a href="#" className="load-more button button--primary" onClick={props.loadMore}>Load More ({props.count}/{props.totalCount})</a> const LoadMore = props => <a href="#" className="load-more button button--primary" onClick={props.loadMore}>Load More ({props.count}/{props.totalCount})</a>

View file

@ -1,3 +1,5 @@
import { Picker } from 'meteor/meteorhacks:picker';
import NovaEmail from 'meteor/nova:email'; import NovaEmail from 'meteor/nova:email';
Meteor.startup(function () { Meteor.startup(function () {

View file

@ -77,10 +77,10 @@ NovaEmail.send = function(to, subject, html, text){
}); });
} }
console.log('//////// sending email…'); console.log('//////// sending email…'); // eslint-disable-line
console.log('from: '+from); console.log('from: '+from); // eslint-disable-line
console.log('to: '+to); console.log('to: '+to); // eslint-disable-line
console.log('subject: '+subject); console.log('subject: '+subject); // eslint-disable-line
// console.log('html: '+html); // console.log('html: '+html);
// console.log('text: '+text); // console.log('text: '+text);
@ -95,8 +95,8 @@ NovaEmail.send = function(to, subject, html, text){
try { try {
Email.send(email); Email.send(email);
} catch (error) { } catch (error) {
console.log("// error while sending email:") console.log("// error while sending email:"); // eslint-disable-line
console.log(error) console.log(error); // eslint-disable-line
} }
return email; return email;

View file

@ -25,15 +25,15 @@ class EmbedlyURL extends Component {
// the URL has changed, get a new thumbnail // the URL has changed, get a new thumbnail
this.context.actions.call("getEmbedlyData", url, (error, result) => { this.context.actions.call("getEmbedlyData", url, (error, result) => {
console.log("querying Embedly…"); console.log("querying Embedly…"); // eslint-disable-line
this.setState({loading: false}); this.setState({loading: false});
if (error) { if (error) {
console.log(error) console.log(error); // eslint-disable-line
this.context.throwError({content: error.message, type: "error"}); this.context.throwError({content: error.message, type: "error"});
} else { } else {
console.log(result) console.log(result); // eslint-disable-line
this.context.addToAutofilledValues({ this.context.addToAutofilledValues({
title: result.title, title: result.title,
body: result.description, body: result.description,
@ -63,7 +63,7 @@ class EmbedlyURL extends Component {
loadingStyle.display = this.state.loading ? "block" : "none"; loadingStyle.display = this.state.loading ? "block" : "none";
// see https://facebook.github.io/react/warnings/unknown-prop.html // see https://facebook.github.io/react/warnings/unknown-prop.html
const {document, updateCurrentValue, control, ...rest} = this.props; const {document, updateCurrentValue, control, ...rest} = this.props; // eslint-disable-line
return ( return (
<div className="embedly-url-field" style={wrapperStyle}> <div className="embedly-url-field" style={wrapperStyle}>

View file

@ -1,7 +1,7 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import Formsy from 'formsy-react'; // import Formsy from 'formsy-react';
import FRC from 'formsy-react-components'; import FRC from 'formsy-react-components';
const Input = FRC.Input; const Input = FRC.Input;
@ -44,7 +44,7 @@ class ThumbnailURL extends Component {
render() { render() {
const {name, value, label} = this.props; const {name, /* value, */ label} = this.props;
const inputType = this.state.showInput ? "text" : "hidden"; const inputType = this.state.showInput ? "text" : "hidden";

View file

@ -10,7 +10,7 @@ Telescope.callbacks.add("postClass", addThumbnailClass);
function checkIfPreviouslyPosted (data) { function checkIfPreviouslyPosted (data) {
Meteor.call("checkForDuplicates", data.url, function (error, result) { Meteor.call("checkForDuplicates", data.url, function (error, result) {
if (error) { if (error) {
Messages.flash(error.reason + '. <a href="'+FlowRouter.path("postPage", {_id: error.details})+'">'+"go_to_post"+'</a>'); // Messages.flash(error.reason + '. <a href="'+FlowRouter.path("postPage", {_id: error.details})+'">'+"go_to_post"+'</a>');
} }
}); });
return data; return data;

View file

@ -2,8 +2,8 @@ import Telescope from 'meteor/nova:lib';
import Posts from "meteor/nova:posts"; import Posts from "meteor/nova:posts";
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
getEmbedlyData = function (url) { var getEmbedlyData = function (url) {
var data = {}; // var data = {};
var extractBase = 'http://api.embed.ly/1/extract'; var extractBase = 'http://api.embed.ly/1/extract';
var embedlyKey = Telescope.settings.get('embedlyKey'); var embedlyKey = Telescope.settings.get('embedlyKey');
var thumbnailWidth = Telescope.settings.get('thumbnailWidth', 200); var thumbnailWidth = Telescope.settings.get('thumbnailWidth', 200);
@ -11,7 +11,7 @@ getEmbedlyData = function (url) {
if(!embedlyKey) { if(!embedlyKey) {
// fail silently to still let the post be submitted as usual // fail silently to still let the post be submitted as usual
console.log("Couldn't find an Embedly API key! Please add it to your Telescope settings or remove the Embedly module."); console.log("Couldn't find an Embedly API key! Please add it to your Telescope settings or remove the Embedly module."); // eslint-disable-line
return null; return null;
} }
@ -42,7 +42,7 @@ getEmbedlyData = function (url) {
return embedlyData; return embedlyData;
} catch (error) { } catch (error) {
console.log(error) console.log(error); // eslint-disable-line
// the first 13 characters of the Embedly errors are "failed [400] ", so remove them and parse the rest // the first 13 characters of the Embedly errors are "failed [400] ", so remove them and parse the rest
var errorObject = JSON.parse(error.message.substring(13)); var errorObject = JSON.parse(error.message.substring(13));
throw new Meteor.Error(errorObject.error_code, errorObject.error_message); throw new Meteor.Error(errorObject.error_code, errorObject.error_message);
@ -111,7 +111,7 @@ var regenerateThumbnail = function (post) {
Meteor.methods({ Meteor.methods({
testGetEmbedlyData: function (url) { testGetEmbedlyData: function (url) {
check(url, String); check(url, String);
console.log(getEmbedlyData(url)); console.log(getEmbedlyData(url)); // eslint-disable-line
}, },
getEmbedlyData: function (url) { getEmbedlyData: function (url) {
check(url, String); check(url, String);
@ -132,7 +132,7 @@ Meteor.methods({
if (Users.isAdmin(Meteor.user())) { if (Users.isAdmin(Meteor.user())) {
console.log("// Generating thumbnails…") console.log("// Generating thumbnails…"); // eslint-disable-line
const selector = {url: {$exists: true}}; const selector = {url: {$exists: true}};
if (mode === "generate") { if (mode === "generate") {
@ -143,11 +143,11 @@ Meteor.methods({
posts.forEach((post, index) => { posts.forEach((post, index) => {
Meteor.setTimeout(function () { Meteor.setTimeout(function () {
console.log(`// ${index}. fetching thumbnail for “${post.title}” (_id: ${post._id})`); console.log(`// ${index}. fetching thumbnail for “${post.title}” (_id: ${post._id})`); // eslint-disable-line
try { try {
regenerateThumbnail(post); regenerateThumbnail(post);
} catch (error) { } catch (error) {
console.log(error); console.log(error); // eslint-disable-line
} }
}, index * 1000); }, index * 1000);
}); });

View file

@ -1,3 +1,5 @@
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
const Events = new Mongo.Collection('events'); const Events = new Mongo.Collection('events');
Events.schema = new SimpleSchema({ Events.schema = new SimpleSchema({

View file

@ -69,7 +69,7 @@ class Tags extends Component {
render() { render() {
const {name, value, label} = this.props; const {name, /* value, */ label} = this.props;
return ( return (
<div className="form-group row"> <div className="form-group row">

View file

@ -1,6 +1,6 @@
import React, { PropTypes, Component } from 'react'; import React, { PropTypes, Component } from 'react';
import DateTimePicker from 'react-datetime'; import DateTimePicker from 'react-datetime';
import moment from 'moment'; // import moment from 'moment';
class DateTime extends Component { class DateTime extends Component {
// when the datetime picker mounts, NovaForm will catch the date value (no formsy mixin in this component) // when the datetime picker mounts, NovaForm will catch the date value (no formsy mixin in this component)

View file

@ -4,7 +4,7 @@ import FRC from 'formsy-react-components';
import DateTime from './DateTime.jsx'; import DateTime from './DateTime.jsx';
import Utils from './utils.js'; // import Utils from './utils.js';
const Checkbox = FRC.Checkbox; const Checkbox = FRC.Checkbox;
// const CheckboxGroup = FRC.CheckboxGroup; // const CheckboxGroup = FRC.CheckboxGroup;
@ -30,7 +30,7 @@ class FormComponent extends Component {
renderComponent() { renderComponent() {
// see https://facebook.github.io/react/warnings/unknown-prop.html // see https://facebook.github.io/react/warnings/unknown-prop.html
const { control, group, updateCurrentValue, document, ...rest } = this.props; const { control, group, updateCurrentValue, document, ...rest } = this.props; // eslint-disable-line
const base = this.props.control === "function" ? this.props : rest; const base = this.props.control === "function" ? this.props : rest;

View file

@ -85,7 +85,7 @@ class NovaForm extends Component{
// backward compatibility from 'autoform' to 'form' // backward compatibility from 'autoform' to 'form'
if (fieldSchema.autoform) { if (fieldSchema.autoform) {
fieldSchema.form = fieldSchema.autoform; fieldSchema.form = fieldSchema.autoform;
console.warn(`🔭 Telescope Nova Warning: The 'autoform' field is deprecated. You should rename it to 'form' instead. It was defined on your '${fieldName}' field on the '${this.props.collection._name}' collection`); console.warn(`🔭 Telescope Nova Warning: The 'autoform' field is deprecated. You should rename it to 'form' instead. It was defined on your '${fieldName}' field on the '${this.props.collection._name}' collection`); // eslint-disable-line
} }
// replace value by prefilled value if value is empty // replace value by prefilled value if value is empty
@ -291,7 +291,7 @@ class NovaForm extends Component{
this.setState({disabled: false}); this.setState({disabled: false});
console.log(error); console.log(error); // eslint-disable-line
const errorContent = this.context.intl.formatMessage({id: error.reason}, {details: error.details}) const errorContent = this.context.intl.formatMessage({id: error.reason}, {details: error.details})
// add error to state // add error to state

View file

@ -1,3 +1,5 @@
/* eslint-disable react/display-name */
'use strict'; 'use strict';
var React = require('react'); var React = require('react');

View file

@ -1,3 +1,5 @@
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
if (typeof SimpleSchema !== "undefined") { if (typeof SimpleSchema !== "undefined") {
SimpleSchema.extendOptions({ SimpleSchema.extendOptions({
control: Match.Optional(Match.Any), // NovaForm control (String or React component) control: Match.Optional(Match.Any), // NovaForm control (String or React component)

View file

@ -92,7 +92,7 @@ var createDummyComments = function () {
}; };
deleteDummyContent = function () { var deleteDummyContent = function () {
Users.remove({'profile.isDummy': true}); Users.remove({'profile.isDummy': true});
Posts.remove({isDummy: true}); Posts.remove({isDummy: true});
Comments.remove({isDummy: true}); Comments.remove({isDummy: true});

View file

@ -1,3 +1,5 @@
/* global InjectData */
Meteor.startup(function() { Meteor.startup(function() {
var dom = $('script[type="text/inject-data"]', document); var dom = $('script[type="text/inject-data"]', document);
var injectedDataString = $.trim(dom.text()); var injectedDataString = $.trim(dom.text());

View file

@ -1 +1,3 @@
/* eslint-disable */
InjectData = {}; InjectData = {};

View file

@ -1,4 +1,6 @@
var http = Npm.require('http'); /* global InjectData */
// var http = Npm.require('http');
var templateText = Assets.getText('lib/inject.html'); var templateText = Assets.getText('lib/inject.html');
var injectDataTemplate = _.template(templateText); var injectDataTemplate = _.template(templateText);
@ -43,7 +45,7 @@ InjectData._hijackWriteIfNeeded = function(res) {
'warn: injecting data turned off due to CORS headers. ' + 'warn: injecting data turned off due to CORS headers. ' +
'read more: http://goo.gl/eGwb4e'; 'read more: http://goo.gl/eGwb4e';
console.warn(warnMessage); console.warn(warnMessage); // eslint-disable-line
originalWrite.call(res, chunk, encoding); originalWrite.call(res, chunk, encoding);
return; return;
} }

View file

@ -1,3 +1,5 @@
/* global InjectData */
InjectData._encode = function(ejson) { InjectData._encode = function(ejson) {
var ejsonString = EJSON.stringify(ejson); var ejsonString = EJSON.stringify(ejson);
return encodeURIComponent(ejsonString); return encodeURIComponent(ejsonString);

View file

@ -1,5 +1,5 @@
var fs = Npm.require('fs'); // var fs = Npm.require('fs');
var path = Npm.require('path'); // var path = Npm.require('path');
// We use this patch to avoid data injection failure during server-side rendering on Meteor 1.4 // We use this patch to avoid data injection failure during server-side rendering on Meteor 1.4
// All the credits for this package goes to Arunoda, Kadira's team & @rigconfig // All the credits for this package goes to Arunoda, Kadira's team & @rigconfig

View file

@ -1,4 +1,5 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import { Kadira } from 'meteor/meteorhacks:kadira';
Meteor.startup(function() { Meteor.startup(function() {
if(process.env.NODE_ENV === "production" && !!Telescope.settings.get('kadiraAppId') && !!Telescope.settings.get('kadiraAppSecret')){ if(process.env.NODE_ENV === "production" && !!Telescope.settings.get('kadiraAppId') && !!Telescope.settings.get('kadiraAppSecret')){

View file

@ -1,5 +1,5 @@
import Telescope from './config.js'; import Telescope from './config.js';
import moment from 'moment'; // import moment from 'moment';
/** /**
* @summary 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.

View file

@ -1,3 +1,4 @@
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import Telescope from './config.js'; import Telescope from './config.js';
/** /**

View file

@ -1,9 +1,11 @@
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
/** /**
* @summary Kick off the global namespace for Telescope. * @summary Kick off the global namespace for Telescope.
* @namespace Telescope * @namespace Telescope
*/ */
Telescope = {}; const Telescope = {};
Telescope.VERSION = '0.27.4-nova'; Telescope.VERSION = '0.27.4-nova';

View file

@ -1,3 +1,4 @@
/* eslint-disable */
// see https://gist.github.com/furf/3208381 // see https://gist.github.com/furf/3208381
_.mixin({ _.mixin({

View file

@ -89,7 +89,7 @@ Telescope.utils.capitalise = function(str) {
Telescope.utils.t = function(message) { Telescope.utils.t = function(message) {
var d = new Date(); var d = new Date();
console.log("### "+message+" rendered at "+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()); console.log("### "+message+" rendered at "+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()); // eslint-disable-line
}; };
Telescope.utils.nl2br = function(str) { Telescope.utils.nl2br = function(str) {
@ -239,7 +239,7 @@ Telescope.utils.checkNested = function(obj /*, level1, level2, ... levelN*/) {
Telescope.log = function (s) { Telescope.log = function (s) {
if(Telescope.settings.get('debug', false) || process.env.NODE_ENV === "development") { if(Telescope.settings.get('debug', false) || process.env.NODE_ENV === "development") {
console.log(s); console.log(s); // eslint-disable-line
} }
}; };

View file

@ -5,8 +5,8 @@ import Users from 'meteor/nova:users';
function subscribeUserOnProfileCompletion (user) { function subscribeUserOnProfileCompletion (user) {
if (!!Telescope.settings.get('autoSubscribe') && !!Users.getEmail(user)) { if (!!Telescope.settings.get('autoSubscribe') && !!Users.getEmail(user)) {
MailChimpList.add(user, false, function (error, result) { MailChimpList.add(user, false, function (error, result) {
console.log(error); console.log(error); // eslint-disable-line
console.log(result); console.log(result); // eslint-disable-line
}); });
} }
return user; return user;

View file

@ -1,6 +1,7 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Newsletter from '../namespace.js'; import { SyncedCron } from 'meteor/percolatestudio:synced-cron';
import moment from 'moment'; import moment from 'moment';
import Newsletter from '../namespace.js';
const defaultFrequency = [1]; // every monday const defaultFrequency = [1]; // every monday
const defaultTime = '00:00'; // GMT const defaultTime = '00:00'; // GMT
@ -45,7 +46,7 @@ var getSchedule = function (parser) {
Meteor.methods({ Meteor.methods({
getNextJob: function () { getNextJob: function () {
var nextJob = SyncedCron.nextScheduledAtDate('scheduleNewsletter'); var nextJob = SyncedCron.nextScheduledAtDate('scheduleNewsletter');
console.log(nextJob); console.log(nextJob); // eslint-disable-line
return nextJob; return nextJob;
} }
}); });
@ -60,8 +61,8 @@ var addJob = function () {
job: function() { job: function() {
// only schedule newsletter campaigns in production // only schedule newsletter campaigns in production
if (process.env.NODE_ENV === "production" || Telescope.settings.get("enableNewsletterInDev", false)) { if (process.env.NODE_ENV === "production" || Telescope.settings.get("enableNewsletterInDev", false)) {
console.log("// Scheduling newsletter…") console.log("// Scheduling newsletter…"); // eslint-disable-line
console.log(new Date()); console.log(new Date()); // eslint-disable-line
Newsletter.scheduleNextWithMailChimp(); Newsletter.scheduleNextWithMailChimp();
} }
} }

View file

@ -23,7 +23,7 @@ const MailChimp = function ( apiKey, options ) {
if ( !mailChimpOptions.apiKey || mailChimpOptions.apiKey === '' ) { if ( !mailChimpOptions.apiKey || mailChimpOptions.apiKey === '' ) {
console.error( '[MailChimp] Error: No API Key defined!' ); console.error( '[MailChimp] Error: No API Key defined!' ); // eslint-disable-line
throw new Meteor.Error( throw new Meteor.Error(
'No API Key', 'No API Key',

View file

@ -30,7 +30,7 @@ MailChimpList.add = function(userOrEmail, confirm, done){
try { try {
console.log('// Adding "'+email+'" to MailChimp list…'); console.log('// Adding "'+email+'" to MailChimp list…'); // eslint-disable-line
var api = new MailChimp(apiKey); var api = new MailChimp(apiKey);
var subscribeOptions = { var subscribeOptions = {
@ -47,7 +47,7 @@ MailChimpList.add = function(userOrEmail, confirm, done){
Users.methods.setSetting(user._id, 'newsletter.subscribed', true); Users.methods.setSetting(user._id, 'newsletter.subscribed', true);
} }
console.log("// User subscribed"); console.log("// User subscribed"); // eslint-disable-line
return subscribe; return subscribe;
@ -55,7 +55,7 @@ MailChimpList.add = function(userOrEmail, confirm, done){
throw new Meteor.Error("subscription-failed", error.message); throw new Meteor.Error("subscription-failed", error.message);
} }
} else { } else {
throw new Meteor.Error("Please provide your MailChimp API key and list ID", error.message); throw new Meteor.Error("Please provide your MailChimp API key and list ID");
} }
}; };
@ -74,7 +74,7 @@ MailChimpList.remove = (user) => {
try { try {
console.log('// Removing "'+email+'" from MailChimp list…'); console.log('// Removing "'+email+'" from MailChimp list…'); // eslint-disable-line
var api = new MailChimp(apiKey); var api = new MailChimp(apiKey);
var subscribeOptions = { var subscribeOptions = {
@ -89,7 +89,7 @@ MailChimpList.remove = (user) => {
// mark user as unsubscribed // mark user as unsubscribed
Users.methods.setSetting(user._id, 'newsletter.subscribed', false); Users.methods.setSetting(user._id, 'newsletter.subscribed', false);
console.log("// User unsubscribed"); console.log("// User unsubscribed"); // eslint-disable-line
return subscribe; return subscribe;
@ -97,7 +97,7 @@ MailChimpList.remove = (user) => {
throw new Meteor.Error("unsubscription-failed", error.message); throw new Meteor.Error("unsubscription-failed", error.message);
} }
} else { } else {
throw new Meteor.Error("Please provide your MailChimp API key and list ID", error.message); throw new Meteor.Error("Please provide your MailChimp API key and list ID");
} }
}; };

View file

@ -1,11 +1,14 @@
/* eslint-disable no-console */
// newsletter scheduling with MailChimp // newsletter scheduling with MailChimp
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Newsletter from '../../namespace.js'; import Posts from 'meteor/nova:posts';
import MailChimp from './mailchimp_api.js';
import NovaEmail from 'meteor/nova:email'; import NovaEmail from 'meteor/nova:email';
import htmlToText from 'html-to-text'; import htmlToText from 'html-to-text';
import moment from 'moment'; import moment from 'moment';
import Newsletter from '../../namespace.js';
import MailChimp from './mailchimp_api.js';
const defaultPosts = 5; const defaultPosts = 5;
@ -68,14 +71,14 @@ Newsletter.scheduleWithMailChimp = function (campaign, isTest = false) {
}; };
// schedule campaign // schedule campaign
var schedule = api.call('campaigns', 'schedule', scheduleOptions); var schedule = api.call('campaigns', 'schedule', scheduleOptions); // eslint-disable-line
console.log('// Newsletter scheduled for '+scheduledTime); console.log('// Newsletter scheduled for '+scheduledTime);
// console.log(schedule) // console.log(schedule)
// if this is not a test, mark posts as sent // if this is not a test, mark posts as sent
if (!isTest) if (!isTest)
var updated = Posts.update({_id: {$in: campaign.postIds}}, {$set: {scheduledAt: new Date()}}, {multi: true}) var updated = Posts.update({_id: {$in: campaign.postIds}}, {$set: {scheduledAt: new Date()}}, {multi: true}) // eslint-disable-line
// send confirmation email // send confirmation email
var confirmationHtml = NovaEmail.getTemplate('newsletterConfirmation')({ var confirmationHtml = NovaEmail.getTemplate('newsletterConfirmation')({

View file

@ -1,10 +1,11 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import moment from 'moment';
import Posts from "meteor/nova:posts"; import Posts from "meteor/nova:posts";
import Comments from "meteor/nova:comments"; import Comments from "meteor/nova:comments";
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
import Categories from "meteor/nova:categories"; import Categories from "meteor/nova:categories";
import NovaEmail from 'meteor/nova:email'; import NovaEmail from 'meteor/nova:email';
import { SyncedCron } from 'meteor/percolatestudio:synced-cron';
import moment from 'moment';
import Newsletter from '../namespace.js'; import Newsletter from '../namespace.js';
// create new "newsletter" view for all posts from the past X days that haven't been scheduled yet // create new "newsletter" view for all posts from the past X days that haven't been scheduled yet

View file

@ -21,7 +21,7 @@ Telescope.notifications.create = (userIds, notificationName, data) => {
if (!!userEmail) { if (!!userEmail) {
NovaEmail.buildAndSendHTML(Users.getEmail(user), subject, html); NovaEmail.buildAndSendHTML(Users.getEmail(user), subject, html);
} else { } else {
console.log(`// Couldn't send notification: admin user ${user._id} doesn't have an email`); console.log(`// Couldn't send notification: admin user ${user._id} doesn't have an email`); // eslint-disable-line
} }
}); });

View file

@ -360,7 +360,7 @@ Telescope.callbacks.add("posts.edit.sync", PostsEditSetPostedAt);
// ------------------------------------- posts.edit.async -------------------------------- // // ------------------------------------- posts.edit.async -------------------------------- //
function PostsEditRunPostApprovedCallbacks (post, oldPost) { function PostsEditRunPostApprovedCallbacks (post, oldPost) {
var now = new Date(); // var now = new Date();
if (Posts.isApproved(post) && !Posts.isApproved(oldPost)) { if (Posts.isApproved(post) && !Posts.isApproved(oldPost)) {
Telescope.callbacks.runAsync("posts.approve.async", post); Telescope.callbacks.runAsync("posts.approve.async", post);
@ -388,7 +388,7 @@ Telescope.callbacks.add("posts.approve.async", PostsApprovedNotification);
function UsersRemoveDeletePosts (user, options) { function UsersRemoveDeletePosts (user, options) {
if (options && options.deletePosts) { if (options && options.deletePosts) {
Posts.remove({userId: userId}); Posts.remove({userId: user._id});
} else { } else {
// not sure if anything should be done in that scenario yet // not sure if anything should be done in that scenario yet
// Posts.update({userId: userId}, {$set: {author: "\[deleted\]"}}, {multi: true}); // Posts.update({userId: userId}, {$set: {author: "\[deleted\]"}}, {multi: true});

View file

@ -4,7 +4,7 @@ const returnEmptyObject = function () {
return {}; return {};
} }
console.log(Mongo) console.log(Mongo); // eslint-disable-line
const Mongo = typeof Mongo !== "undefined" ? Mongo : { const Mongo = typeof Mongo !== "undefined" ? Mongo : {
Collection: function () { Collection: function () {
@ -12,8 +12,8 @@ const Mongo = typeof Mongo !== "undefined" ? Mongo : {
} }
}; };
console.log("// Mongo") console.log("// Mongo"); // eslint-disable-line
console.log(Mongo) console.log(Mongo); // eslint-disable-line
const Meteor = typeof Meteor !== "undefined" ? Meteor : { const Meteor = typeof Meteor !== "undefined" ? Meteor : {
methods: returnEmptyObject methods: returnEmptyObject

View file

@ -1,7 +1,8 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Posts from './collection.js'
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
import Events from "meteor/nova:events"; import Events from 'meteor/nova:events';
import { Messages } from 'meteor/nova:core';
import Posts from './collection.js'
/** /**
* *

View file

@ -1,6 +1,7 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Posts from './collection.js' import { Injected } from 'meteor/meteorhacks:inject-initial';
import moment from 'moment'; import moment from 'moment';
import Posts from './collection.js'
/** /**
* @summary Parameter callbacks let you add parameters to subscriptions * @summary Parameter callbacks let you add parameters to subscriptions

View file

@ -1,6 +1,7 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Posts from './collection.js';
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import Posts from './collection.js';
/** /**
* @summary Posts config namespace * @summary Posts config namespace

View file

@ -1,5 +1,6 @@
import { SyncedCron } from 'meteor/percolatestudio:synced-cron';
// import moment from 'moment';
import Posts from '../collection.js'; import Posts from '../collection.js';
import moment from 'moment';
SyncedCron.options = { SyncedCron.options = {
log: true, log: true,
@ -28,7 +29,7 @@ const addJob = function () {
Posts.update({_id: {$in: postsIds}}, {$set: {isFuture: false}}, {multi: true}); Posts.update({_id: {$in: postsIds}}, {$set: {isFuture: false}}, {multi: true});
// log the action // log the action
console.log('// Scheduled posts approved:', postsIds); console.log('// Scheduled posts approved:', postsIds); // eslint-disable-line
} }
} }
}); });

View file

@ -1,7 +1,8 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Posts from '../collection.js';
// import Comments from "meteor/nova:comments"; // import Comments from "meteor/nova:comments";
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
import { Counts } from 'meteor/tmeasday:publish-counts';
import Posts from '../collection.js';
Posts._ensureIndex({"status": 1, "postedAt": 1}); Posts._ensureIndex({"status": 1, "postedAt": 1});
@ -112,7 +113,7 @@ Meteor.publish('posts.single', function (terms) {
const users = getSinglePostUsers(post); const users = getSinglePostUsers(post);
return Users.canView(currentUser, post) ? [posts, users] : []; return Users.canView(currentUser, post) ? [posts, users] : [];
} else { } else {
console.log(`// posts.single: no post found for _id “${terms._id}`) console.log(`// posts.single: no post found for _id “${terms._id}`); // eslint-disable-line
return []; return [];
} }

View file

@ -1,5 +1,6 @@
import Posts from '../collection.js'; import { Picker } from 'meteor/meteorhacks:picker';
import escapeStringRegexp from 'escape-string-regexp'; import escapeStringRegexp from 'escape-string-regexp';
import Posts from '../collection.js';
Picker.route('/out', function(params, req, res, next) { Picker.route('/out', function(params, req, res, next) {
var query = params.query; var query = params.query;

View file

@ -1,3 +1,4 @@
import Users from 'meteor/nova:users';
import Posts from './collection.js' import Posts from './collection.js'
/** /**

View file

@ -1,3 +1,4 @@
import { Picker } from 'meteor/meteorhacks:picker';
import { servePostRSS, serveCommentRSS } from './rss.js'; import { servePostRSS, serveCommentRSS } from './rss.js';
Picker.route('/feed.xml', function(params, req, res, next) { Picker.route('/feed.xml', function(params, req, res, next) {

View file

@ -52,9 +52,9 @@ const serveCommentRSS = function (terms, url) {
var feed = new RSS(getMeta(url)); var feed = new RSS(getMeta(url));
Comments.find({isDeleted: {$ne: true}}, {sort: {postedAt: -1}, limit: 20}).forEach(function(comment) { Comments.find({isDeleted: {$ne: true}}, {sort: {postedAt: -1}, limit: 20}).forEach(function(comment) {
post = Posts.findOne(comment.postId); var post = Posts.findOne(comment.postId);
feed.item({ feed.item({
title: 'Comment on '+post.title, title: 'Comment on ' + post.title,
description: `${comment.body}</br></br><a href="${comment.getPageUrl(true)}">Discuss</a>`, description: `${comment.body}</br></br><a href="${comment.getPageUrl(true)}">Discuss</a>`,
author: comment.author, author: comment.author,
date: comment.postedAt, date: comment.postedAt,

View file

@ -1,5 +1,6 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
const isInSettingsJSON = function () { const isInSettingsJSON = function () {
// settings can either be in settings json's public, or in the special object we publish only for admins for private settings // settings can either be in settings json's public, or in the special object we publish only for admins for private settings

View file

@ -16,7 +16,7 @@ Meteor.methods({
"settings.exportToJSON": function () { "settings.exportToJSON": function () {
if (Users.isAdminById(this.userId)) { if (Users.isAdminById(this.userId)) {
let settings = Telescope.settings.collection.findOne(); let settings = Telescope.settings.collection.findOne();
const schema = Telescope.settings.collection.simpleSchema()._schema; // const schema = Telescope.settings.collection.simpleSchema()._schema;
const publicFields = Telescope.settings.collection.getPublicFields(); const publicFields = Telescope.settings.collection.getPublicFields();
delete settings._id; delete settings._id;
settings.public = {}; settings.public = {};
@ -26,7 +26,7 @@ Meteor.methods({
delete settings[key]; delete settings[key];
} }
}); });
console.log(JSON.stringify(settings, null, 2)); console.log(JSON.stringify(settings, null, 2)); // eslint-disable-line
return settings; return settings;
} }
}, },

View file

@ -1,5 +1,5 @@
import PublicationUtils from 'meteor/utilities:smart-publications'; import PublicationUtils from 'meteor/utilities:smart-publications';
import Users from "meteor/nova:users"; import Users from 'meteor/nova:users';
Users.addField([ Users.addField([
{ {

View file

@ -132,6 +132,7 @@ const performSubscriptionAction = (action, collection, itemId, user) => {
* @summary Generate methods 'collection.subscribe' & 'collection.unsubscribe' automatically * @summary Generate methods 'collection.subscribe' & 'collection.unsubscribe' automatically
* @params {Array[Collections]} collections * @params {Array[Collections]} collections
*/ */
let subscribeMethodsGenerator;
export default subscribeMethodsGenerator = (collection) => { export default subscribeMethodsGenerator = (collection) => {
// generic method function calling the performSubscriptionAction // generic method function calling the performSubscriptionAction

View file

@ -1,3 +1,5 @@
import Users from 'meteor/nova:users';
if (typeof Package['nova:posts'] !== "undefined") { if (typeof Package['nova:posts'] !== "undefined") {
import Posts from "meteor/nova:posts"; import Posts from "meteor/nova:posts";

View file

@ -1,3 +1,4 @@
import { Gravatar } from 'meteor/jparker:gravatar';
import Users from './collection.js'; import Users from './collection.js';
// var _ = require('underscore'); // var _ = require('underscore');
@ -191,7 +192,7 @@ Users.avatar = {
return service[0]; return service[0];
}, },
computeUrl: function(prop) { computeUrl: function(prop, user) {
if (typeof prop === 'function') { if (typeof prop === 'function') {
prop = prop.call(user); prop = prop.call(user);
} }
@ -210,9 +211,9 @@ Users.avatar = {
var customProp = user && this.options.customImageProperty; var customProp = user && this.options.customImageProperty;
if (typeof customProp === 'function') { if (typeof customProp === 'function') {
return this.computeUrl(customProp); return this.computeUrl(customProp, user);
} else if (customProp) { } else if (customProp) {
return this.computeUrl(this.getDescendantProp(user, customProp)); return this.computeUrl(this.getDescendantProp(user, customProp), user);
} }
}, },
@ -230,7 +231,7 @@ Users.avatar = {
} }
var emailOrHash = this.getUserEmail(user) || Users.getEmailHash(user); var emailOrHash = this.getUserEmail(user) || Users.getEmailHash(user);
var secure = true; // var secure = true;
var options = { var options = {
// NOTE: Gravatar's default option requires a publicly accessible URL, // NOTE: Gravatar's default option requires a publicly accessible URL,
// so it won't work when your app is running on localhost and you're // so it won't work when your app is running on localhost and you're

View file

@ -1,8 +1,9 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Users from './collection.js';
import marked from 'marked';
import Events from "meteor/nova:events"; import Events from "meteor/nova:events";
import NovaEmail from 'meteor/nova:email'; import NovaEmail from 'meteor/nova:email';
import { Gravatar } from 'meteor/jparker:gravatar';
import marked from 'marked';
import Users from './collection.js';
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// Collection Hooks // // Collection Hooks //

View file

@ -39,7 +39,7 @@ Users.getUserName = function (user) {
return user.services.twitter.screenName; return user.services.twitter.screenName;
} }
catch (error){ catch (error){
console.log(error); console.log(error); // eslint-disable-line
return null; return null;
} }
}; };

View file

@ -1,6 +1,7 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import Users from './collection.js'; import Users from './collection.js';
/*
var completeUserProfile = function (userId, modifier, user) { var completeUserProfile = function (userId, modifier, user) {
Users.update(userId, modifier); Users.update(userId, modifier);
@ -10,6 +11,7 @@ var completeUserProfile = function (userId, modifier, user) {
return Users.findOne(userId); return Users.findOne(userId);
}; };
*/
Users.methods = {}; Users.methods = {};

View file

@ -1,4 +1,5 @@
import Telescope from 'meteor/nova:lib'; import Telescope from 'meteor/nova:lib';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import Users from './collection.js'; import Users from './collection.js';
const adminGroup = { const adminGroup = {

Some files were not shown because too many files have changed in this diff Show more