mirror of
https://github.com/vale981/Vulcan
synced 2025-03-04 17:21:37 -05:00
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:
parent
99c8d6ef34
commit
464e20a96c
102 changed files with 548 additions and 457 deletions
1
.eslintignore
Normal file
1
.eslintignore
Normal file
|
@ -0,0 +1 @@
|
|||
packages/_*
|
29
.eslintrc
29
.eslintrc
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"extends": [
|
||||
"eslint:recommended"
|
||||
"eslint:recommended",
|
||||
"plugin:meteor/recommended",
|
||||
"plugin:react/recommended"
|
||||
],
|
||||
"parser": "babel-eslint",
|
||||
"parserOptions": {
|
||||
|
@ -10,7 +12,17 @@
|
|||
},
|
||||
"rules": {
|
||||
"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/object-curly-spacing": 0,
|
||||
"babel/object-shorthand": 0,
|
||||
|
@ -20,8 +32,14 @@
|
|||
"key-spacing": 0,
|
||||
"no-extra-boolean-cast": 0,
|
||||
"no-undef": 1,
|
||||
"no-unused-vars": 1,
|
||||
"no-console": 1
|
||||
"no-unused-vars": [1, {
|
||||
"vars": "all",
|
||||
"args": "none",
|
||||
"varsIgnorePattern": "React|PropTypes|Component"
|
||||
}],
|
||||
"no-console": 1,
|
||||
"react/prop-types": 0,
|
||||
"meteor/audit-argument-checks": 0
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
|
@ -32,7 +50,8 @@
|
|||
},
|
||||
"plugins": [
|
||||
"babel",
|
||||
"meteor"
|
||||
"meteor",
|
||||
"react"
|
||||
],
|
||||
"settings": {
|
||||
"import/resolver": "meteor"
|
||||
|
|
|
@ -9,7 +9,7 @@ functions, event handlers, etc.).
|
|||
|
||||
import Telescope from 'meteor/nova:lib';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage, intlShape } from 'react-intl';
|
||||
import { FormattedMessage /*, intlShape */ } from 'react-intl';
|
||||
|
||||
class CustomNewsletter extends Telescope.components.Newsletter {
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
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 Posts from "meteor/nova:posts";
|
||||
import Categories from "meteor/nova:categories";
|
||||
// import { Button } from 'react-bootstrap';
|
||||
// import moment from 'moment';
|
||||
// import { ModalTrigger } from "meteor/nova:core";
|
||||
// import Categories from "meteor/nova:categories";
|
||||
|
||||
class CustomPostsItem extends Telescope.components.PostsItem {
|
||||
|
||||
|
@ -61,7 +61,7 @@ class CustomPostsItem extends Telescope.components.PostsItem {
|
|||
</div>
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
CustomPostsItem.propTypes = {
|
||||
post: React.PropTypes.object.isRequired
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { Picker } from 'meteor/meteorhacks:picker';
|
||||
import { servePostsApi } from './api.js';
|
||||
|
||||
// for backwards compatibility's sake, accept a "limit" segment
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
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 { FormattedMessage } from 'react-intl';
|
||||
import NovaForm from "meteor/nova:forms";
|
||||
import { DocumentContainer } from "meteor/utilities:react-list-container";
|
||||
import Categories from "meteor/nova:categories";
|
||||
// import { DocumentContainer } from "meteor/utilities:react-list-container";
|
||||
|
||||
class CategoriesEditForm extends Component{
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import { /* ModalTrigger, */ ContextPasser } from "meteor/nova:core";
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { Button, DropdownButton, MenuItem, Modal } from 'react-bootstrap';
|
||||
import { /* ModalTrigger, */ ContextPasser } from "meteor/nova:core";
|
||||
import { withRouter } from 'react-router'
|
||||
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
|
||||
|
||||
|
@ -84,7 +84,7 @@ class CategoriesList extends Component {
|
|||
render() {
|
||||
|
||||
const categories = this.props.categories;
|
||||
const context = this.context;
|
||||
// const context = this.context;
|
||||
const currentQuery = _.clone(this.props.router.location.query);
|
||||
delete currentQuery.cat;
|
||||
|
||||
|
@ -115,7 +115,7 @@ class CategoriesList extends Component {
|
|||
)
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
CategoriesList.propTypes = {
|
||||
categories: React.PropTypes.array
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Users from 'meteor/nova:users';
|
||||
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 { 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 {
|
||||
|
||||
|
@ -26,7 +26,7 @@ class Category extends Component {
|
|||
|
||||
const {category, index, router} = this.props;
|
||||
|
||||
const currentQuery = router.location.query;
|
||||
// const currentQuery = router.location.query;
|
||||
const currentCategorySlug = router.location.query.cat;
|
||||
const newQuery = _.clone(router.location.query);
|
||||
newQuery.cat = category.slug;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import moment from 'moment';
|
||||
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{
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import React from 'react';
|
||||
import {injectIntl, FormattedMessage} from 'react-intl';
|
||||
import {/* injectIntl, */ FormattedMessage} from 'react-intl';
|
||||
|
||||
const CommentsList = ({results, hasMore, ready, count, totalCount, loadMore}) => {
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class CommentsNew extends Component {
|
|||
)
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
CommentsNew.propTypes = {
|
||||
postId: React.PropTypes.string.isRequired,
|
||||
|
|
|
@ -31,7 +31,7 @@ class CommentsNode extends Component {
|
|||
)
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
CommentsNode.propTypes = {
|
||||
comment: React.PropTypes.object.isRequired, // the current comment
|
||||
|
|
|
@ -29,7 +29,7 @@ class Newsletter extends Component {
|
|||
subscribeEmail(data) {
|
||||
this.context.actions.call("newsletter.addEmail", data.email, (error, result) => {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
console.log(error); // eslint-disable-line
|
||||
this.context.messages.flash(error.message, "error");
|
||||
} else {
|
||||
this.successCallbackSubscription(result);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { Button } from 'react-bootstrap';
|
||||
import { Messages } from 'meteor/nova:core';
|
||||
// import { Messages } from 'meteor/nova:core';
|
||||
import Users from 'meteor/nova:users';
|
||||
|
||||
class NewsletterButton extends Component {
|
||||
|
@ -15,7 +15,7 @@ class NewsletterButton extends Component {
|
|||
'newsletter.removeUser' : 'newsletter.addUser';
|
||||
this.context.actions.call(action, this.props.user, (error, result) => {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
console.log(error); // eslint-disable-line
|
||||
this.context.messages.flash(error.message, "error");
|
||||
} else {
|
||||
this.props.successCallback(result);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Users from 'meteor/nova:users';
|
||||
import { T9n } from 'meteor/softwarerero:accounts-t9n';
|
||||
|
||||
// import { checkNpmVersions } from 'meteor/tmeasday:check-npm-versions';
|
||||
// checkNpmVersions({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Telescope from "meteor/nova:lib";
|
||||
import React, { PropTypes, Component } from "react";
|
||||
import { Button } from "react-bootstrap";
|
||||
// import { Button } from "react-bootstrap";
|
||||
import moment from "moment";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
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 { ListContainer } from "meteor/utilities:react-list-container";
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import moment from 'moment';
|
||||
|
||||
class PostsDay extends Component {
|
||||
|
||||
|
@ -19,7 +19,7 @@ class PostsDay extends Component {
|
|||
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);
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
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 { DocumentContainer } from "meteor/utilities:react-list-container";
|
||||
import Posts from "meteor/nova:posts";
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage, intlShape } from 'react-intl';
|
||||
// import { Messages } from "meteor/nova:core";
|
||||
// import Actions from "../actions.js";
|
||||
import Posts from "meteor/nova:posts";
|
||||
import Users from 'meteor/nova:users';
|
||||
// import Users from 'meteor/nova:users';
|
||||
|
||||
class PostsEditForm extends Component{
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
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";
|
||||
|
||||
class PostsHome extends Component {
|
||||
|
@ -29,6 +29,6 @@ class PostsHome extends Component {
|
|||
/>
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = PostsHome;
|
|
@ -1,12 +1,12 @@
|
|||
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 { 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 Posts from "meteor/nova:posts";
|
||||
import Users from 'meteor/nova:users';
|
||||
// import { Button } from 'react-bootstrap';
|
||||
// import moment from 'moment';
|
||||
// import Users from 'meteor/nova:users';
|
||||
|
||||
class PostsItem extends Component {
|
||||
|
||||
|
@ -81,7 +81,7 @@ class PostsItem extends Component {
|
|||
</div>
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PostsItem.propTypes = {
|
||||
post: React.PropTypes.object.isRequired
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
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 { withRouter } from 'react-router'
|
||||
import Users from 'meteor/nova:users';
|
||||
|
|
|
@ -23,12 +23,12 @@ class AccountsButton extends Accounts.ui.Button {
|
|||
render () {
|
||||
const {label, href, type, disabled, className, onClick} = this.props;
|
||||
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
|
||||
bsStyle="primary"
|
||||
className={ className }
|
||||
type={ type }
|
||||
type={ type }
|
||||
disabled={ disabled }
|
||||
onClick={ onClick }>{ label }
|
||||
</Button>;
|
||||
|
@ -46,11 +46,11 @@ class AccountsField extends Accounts.ui.Field {
|
|||
}
|
||||
|
||||
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;
|
||||
return mount ? (
|
||||
<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>
|
||||
) : null;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { Dropdown, Button } from 'react-bootstrap';
|
||||
import { Dropdown /* , Button */ } from 'react-bootstrap';
|
||||
|
||||
const UsersAccountMenu = () => {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
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 { Messages } from "meteor/nova:core";
|
||||
import Users from 'meteor/nova:users';
|
||||
|
@ -9,7 +9,7 @@ import Users from 'meteor/nova:users';
|
|||
const UsersEdit = (props, context) => {
|
||||
|
||||
const user = props.user;
|
||||
const currentUser = props.currentUser;
|
||||
// const currentUser = props.currentUser;
|
||||
|
||||
//const label = `Edit profile for ${Users.getDisplayName(user)}`;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React, { Component } from 'react';
|
||||
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';
|
||||
|
||||
class UsersResetPassword extends Component {
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import React from 'react';
|
||||
import {mount} from 'react-mounter';
|
||||
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 { ReactRouterSSR } from 'meteor/reactrouter:react-router-ssr';
|
||||
import React from 'react';
|
||||
import Helmet from 'react-helmet';
|
||||
import Cookie from 'react-cookie';
|
||||
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 };
|
||||
|
||||
|
@ -33,7 +33,7 @@ Meteor.startup(() => {
|
|||
childRoutes: Telescope.routes.routes
|
||||
}
|
||||
|
||||
let history;
|
||||
// let history;
|
||||
|
||||
const clientOptions = {
|
||||
renderHook: ReactDOM.render,
|
||||
|
|
|
@ -18,7 +18,8 @@ Categories.getParents = function (category) {
|
|||
categoriesArray.push(parent);
|
||||
recurse(parent);
|
||||
}
|
||||
}(category);
|
||||
};
|
||||
getParents(category);
|
||||
|
||||
return categoriesArray;
|
||||
};
|
||||
|
@ -37,7 +38,8 @@ Categories.getChildren = function (category) {
|
|||
categoriesArray = categoriesArray.concat(children);
|
||||
recurse(children);
|
||||
}
|
||||
}([category]);
|
||||
};
|
||||
getChildren([category]);
|
||||
|
||||
return categoriesArray;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Categories from "./collection.js";
|
||||
import Users from 'meteor/nova:users';
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
|
||||
const canInsert = user => Users.canDo(user, "categories.new");
|
||||
const canEdit = user => Users.canDo(user, "categories.edit.all");
|
||||
|
|
|
@ -19,7 +19,7 @@ if (Meteor.settings && Meteor.settings.categories) {
|
|||
} else {
|
||||
// if not, create it
|
||||
Categories.insert(category);
|
||||
console.log(`// Creating category “${category.name}”`);
|
||||
console.log(`// Creating category “${category.name}”`); // eslint-disable-line
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Posts from "meteor/nova:posts";
|
||||
// import Posts from "meteor/nova:posts";
|
||||
import Users from 'meteor/nova:users';
|
||||
import Categories from "../collection.js";
|
||||
|
||||
|
@ -9,6 +9,8 @@ Meteor.publish('categories', function() {
|
|||
if(Users.canDo(currentUser, "posts.view.approved.all")){
|
||||
|
||||
var categories = Categories.find({}, {fields: Categories.publishedFields.list});
|
||||
|
||||
/*
|
||||
var publication = this;
|
||||
|
||||
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}]});
|
||||
// Counts.publish(publication, category.getCounterName(), cursor, { noReady: true });
|
||||
});
|
||||
*/
|
||||
|
||||
return categories;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import PublicationUtils from 'meteor/utilities:smart-publications';
|
||||
|
||||
|
@ -20,7 +21,7 @@ Posts.addField([
|
|||
]);
|
||||
|
||||
if (typeof Settings !== "undefined") {
|
||||
Settings.addField([
|
||||
Telescope.settings.collection.addField([
|
||||
{
|
||||
fieldName: 'cloudinaryCloudName',
|
||||
fieldSchema: {
|
||||
|
|
|
@ -26,8 +26,8 @@ const CloudinaryUtils = {
|
|||
};
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.log("// Cloudinary upload failed for URL: "+imageUrl);
|
||||
console.log(error.stack);
|
||||
console.log("// Cloudinary upload failed for URL: "+imageUrl); // eslint-disable-line
|
||||
console.log(error.stack); // eslint-disable-line
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -56,7 +56,7 @@ Meteor.methods({
|
|||
if (Users.isAdmin(Meteor.user())) {
|
||||
thumbnailUrl = typeof thumbnailUrl === "undefined" ? "http://www.telescopeapp.org/images/logo.png" : thumbnailUrl;
|
||||
const data = CloudinaryUtils.uploadImage(thumbnailUrl);
|
||||
console.log(data);
|
||||
console.log(data); // eslint-disable-line
|
||||
}
|
||||
},
|
||||
cachePostThumbnails: function (limit = 20) {
|
||||
|
@ -71,7 +71,7 @@ Meteor.methods({
|
|||
postsWithUncachedThumbnails.forEach(Meteor.bindEnvironment((post, index) => {
|
||||
|
||||
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);
|
||||
Posts.update(post._id, {$set:{
|
||||
|
|
|
@ -278,7 +278,7 @@ Telescope.callbacks.add("comments.edit.method", CommentsEditSubmittedPropertiesC
|
|||
|
||||
function UsersRemoveDeleteComments (user, options) {
|
||||
if (options && options.deleteComments) {
|
||||
Comments.remove({userId: userId});
|
||||
Comments.remove({userId: user._id});
|
||||
} else {
|
||||
// not sure if anything should be done in that scenario yet
|
||||
// Comments.update({userId: userId}, {$set: {author: "\[deleted\]"}}, {multi: true});
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
* @summary The global namespace for Comments.
|
||||
* @namespace Comments
|
||||
*/
|
||||
Comments = new Mongo.Collection("comments");
|
||||
const Comments = new Mongo.Collection("comments");
|
||||
|
||||
export default Comments;
|
|
@ -1,6 +1,6 @@
|
|||
import PublicationUtils from 'meteor/utilities:smart-publications';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import Users from "meteor/nova:users";
|
||||
import Posts from 'meteor/nova:posts';
|
||||
import Users from 'meteor/nova:users';
|
||||
|
||||
Posts.addField([
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
// import Telescope from 'meteor/nova:lib';
|
||||
import Comments from './collection.js';
|
||||
import Posts from 'meteor/nova:posts';
|
||||
import Users from 'meteor/nova:users';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Comments from './collection.js';
|
||||
import PublicationsUtils from 'meteor/utilities:smart-publications';
|
||||
import Posts from "meteor/nova:posts";
|
||||
// import Posts from "meteor/nova:posts";
|
||||
|
||||
Comments.publishedFields = {};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Comments from './collection.js';
|
||||
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
|
||||
const canInsert = user => Users.canDo(user, "comments.new");
|
||||
|
@ -10,7 +10,7 @@ const canInsert = user => Users.canDo(user, "comments.new");
|
|||
const canEdit = Users.canEdit;
|
||||
|
||||
// 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
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Posts from "meteor/nova:posts";
|
||||
import Users from 'meteor/nova:users';
|
||||
import Comments from '../collection.js';
|
||||
|
||||
Comments._ensureIndex({postId: 1});
|
||||
Comments._ensureIndex({parentCommentId: 1});
|
||||
|
@ -13,7 +14,7 @@ Meteor.publish('comments.list', function (terms) {
|
|||
const currentUser = this.userId && Users.findOne(this.userId);
|
||||
|
||||
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
|
||||
// Counts.publish(this, 'comments.list', Comments.find(selector, options));
|
||||
|
|
|
@ -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
|
||||
|
@ -7,6 +7,8 @@ import Telescope from 'meteor/nova:lib';
|
|||
* @param {object} collection - The collection the item belongs to
|
||||
* @param {string} operation - The operation being performed
|
||||
*/
|
||||
|
||||
/*
|
||||
function updateScore (item, user, collection, operation) {
|
||||
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("cancelUpvote.async", updateScore);
|
||||
Telescope.callbacks.add("cancelDownvote.async", updateScore);
|
||||
*/
|
||||
|
||||
/**
|
||||
* @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 {string} operation - The operation being performed
|
||||
*/
|
||||
|
||||
/*
|
||||
function updateUser (item, user, collection, operation) {
|
||||
|
||||
var update = {};
|
||||
|
@ -54,6 +59,7 @@ Telescope.callbacks.add("upvote.async", updateUser);
|
|||
Telescope.callbacks.add("downvote.async", updateUser);
|
||||
Telescope.callbacks.add("cancelUpvote.async", updateUser);
|
||||
Telescope.callbacks.add("cancelDownvote.async", updateUser);
|
||||
*/
|
||||
|
||||
/**
|
||||
* @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 {string} operation - The operation being performed
|
||||
*/
|
||||
|
||||
/*
|
||||
function updateKarma (item, user, collection, operation) {
|
||||
|
||||
var votePower = Telescope.getVotePower(user);
|
||||
|
@ -77,3 +85,4 @@ Telescope.callbacks.add("upvote.async", updateKarma);
|
|||
Telescope.callbacks.add("downvote.async", updateKarma);
|
||||
Telescope.callbacks.add("cancelUpvote.async", updateKarma);
|
||||
Telescope.callbacks.add("cancelDownvote.async", updateKarma);
|
||||
*/
|
||||
|
|
|
@ -62,7 +62,7 @@ class ModalTrigger extends Component {
|
|||
</div>
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ModalTrigger.propTypes = {
|
||||
component: React.PropTypes.object.isRequired,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import {Inject} from 'meteor/meteorhacks:inject-initial';
|
||||
import Events from "meteor/nova:events";
|
||||
import { Inject } from 'meteor/meteorhacks:inject-initial';
|
||||
import { SyncedCron } from 'meteor/percolatestudio:synced-cron';
|
||||
|
||||
Meteor.startup(function () {
|
||||
Events.log({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import Comments from "meteor/nova:comments";
|
||||
// import Posts from "meteor/nova:posts";
|
||||
// import Comments from "meteor/nova:comments";
|
||||
import Users from 'meteor/nova:users';
|
||||
|
||||
const Group = ({name, actions}) => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable no-undef */
|
||||
|
||||
import TelescopeImport from 'meteor/nova:lib';
|
||||
import PostsImport from "meteor/nova:posts";
|
||||
import CommentsImport from "meteor/nova:comments";
|
||||
|
|
|
@ -9,7 +9,7 @@ Meteor.methods({
|
|||
|
||||
if(Users.isAdminById(this.userId)){
|
||||
|
||||
console.log("// testing email ["+emailName+"]");
|
||||
console.log("// testing email ["+emailName+"]"); // eslint-disable-line
|
||||
let html, properties;
|
||||
|
||||
// if email has a custom way of generating its HTML, use it
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
/* global Movies:true */
|
||||
|
||||
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 { 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 //
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
/* global Movies */
|
||||
|
||||
import Telescope from 'meteor/nova:lib';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { ListContainer } from "meteor/utilities:react-list-container";
|
||||
import NovaForm from "meteor/nova:forms";
|
||||
import { Button } from 'react-bootstrap';
|
||||
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;
|
||||
|
||||
|
@ -78,7 +80,7 @@ class MoviesList extends Component {
|
|||
</div>
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// 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>
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { Picker } from 'meteor/meteorhacks:picker';
|
||||
|
||||
import NovaEmail from 'meteor/nova:email';
|
||||
|
||||
Meteor.startup(function () {
|
||||
|
|
|
@ -77,10 +77,10 @@ NovaEmail.send = function(to, subject, html, text){
|
|||
});
|
||||
}
|
||||
|
||||
console.log('//////// sending email…');
|
||||
console.log('from: '+from);
|
||||
console.log('to: '+to);
|
||||
console.log('subject: '+subject);
|
||||
console.log('//////// sending email…'); // eslint-disable-line
|
||||
console.log('from: '+from); // eslint-disable-line
|
||||
console.log('to: '+to); // eslint-disable-line
|
||||
console.log('subject: '+subject); // eslint-disable-line
|
||||
// console.log('html: '+html);
|
||||
// console.log('text: '+text);
|
||||
|
||||
|
@ -95,8 +95,8 @@ NovaEmail.send = function(to, subject, html, text){
|
|||
try {
|
||||
Email.send(email);
|
||||
} catch (error) {
|
||||
console.log("// error while sending email:")
|
||||
console.log(error)
|
||||
console.log("// error while sending email:"); // eslint-disable-line
|
||||
console.log(error); // eslint-disable-line
|
||||
}
|
||||
|
||||
return email;
|
||||
|
|
|
@ -25,15 +25,15 @@ class EmbedlyURL extends Component {
|
|||
// the URL has changed, get a new thumbnail
|
||||
this.context.actions.call("getEmbedlyData", url, (error, result) => {
|
||||
|
||||
console.log("querying Embedly…");
|
||||
console.log("querying Embedly…"); // eslint-disable-line
|
||||
|
||||
this.setState({loading: false});
|
||||
|
||||
if (error) {
|
||||
console.log(error)
|
||||
console.log(error); // eslint-disable-line
|
||||
this.context.throwError({content: error.message, type: "error"});
|
||||
} else {
|
||||
console.log(result)
|
||||
console.log(result); // eslint-disable-line
|
||||
this.context.addToAutofilledValues({
|
||||
title: result.title,
|
||||
body: result.description,
|
||||
|
@ -63,7 +63,7 @@ class EmbedlyURL extends Component {
|
|||
loadingStyle.display = this.state.loading ? "block" : "none";
|
||||
|
||||
// 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 (
|
||||
<div className="embedly-url-field" style={wrapperStyle}>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import Formsy from 'formsy-react';
|
||||
// import Formsy from 'formsy-react';
|
||||
import FRC from 'formsy-react-components';
|
||||
const Input = FRC.Input;
|
||||
|
||||
|
@ -44,7 +44,7 @@ class ThumbnailURL extends Component {
|
|||
|
||||
render() {
|
||||
|
||||
const {name, value, label} = this.props;
|
||||
const {name, /* value, */ label} = this.props;
|
||||
|
||||
const inputType = this.state.showInput ? "text" : "hidden";
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ Telescope.callbacks.add("postClass", addThumbnailClass);
|
|||
function checkIfPreviouslyPosted (data) {
|
||||
Meteor.call("checkForDuplicates", data.url, function (error, result) {
|
||||
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;
|
||||
|
|
|
@ -2,8 +2,8 @@ import Telescope from 'meteor/nova:lib';
|
|||
import Posts from "meteor/nova:posts";
|
||||
import Users from 'meteor/nova:users';
|
||||
|
||||
getEmbedlyData = function (url) {
|
||||
var data = {};
|
||||
var getEmbedlyData = function (url) {
|
||||
// var data = {};
|
||||
var extractBase = 'http://api.embed.ly/1/extract';
|
||||
var embedlyKey = Telescope.settings.get('embedlyKey');
|
||||
var thumbnailWidth = Telescope.settings.get('thumbnailWidth', 200);
|
||||
|
@ -11,7 +11,7 @@ getEmbedlyData = function (url) {
|
|||
|
||||
if(!embedlyKey) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ getEmbedlyData = function (url) {
|
|||
return embedlyData;
|
||||
|
||||
} 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
|
||||
var errorObject = JSON.parse(error.message.substring(13));
|
||||
throw new Meteor.Error(errorObject.error_code, errorObject.error_message);
|
||||
|
@ -111,7 +111,7 @@ var regenerateThumbnail = function (post) {
|
|||
Meteor.methods({
|
||||
testGetEmbedlyData: function (url) {
|
||||
check(url, String);
|
||||
console.log(getEmbedlyData(url));
|
||||
console.log(getEmbedlyData(url)); // eslint-disable-line
|
||||
},
|
||||
getEmbedlyData: function (url) {
|
||||
check(url, String);
|
||||
|
@ -132,7 +132,7 @@ Meteor.methods({
|
|||
|
||||
if (Users.isAdmin(Meteor.user())) {
|
||||
|
||||
console.log("// Generating thumbnails…")
|
||||
console.log("// Generating thumbnails…"); // eslint-disable-line
|
||||
|
||||
const selector = {url: {$exists: true}};
|
||||
if (mode === "generate") {
|
||||
|
@ -143,11 +143,11 @@ Meteor.methods({
|
|||
|
||||
posts.forEach((post, index) => {
|
||||
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 {
|
||||
regenerateThumbnail(post);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.log(error); // eslint-disable-line
|
||||
}
|
||||
}, index * 1000);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
|
||||
const Events = new Mongo.Collection('events');
|
||||
|
||||
Events.schema = new SimpleSchema({
|
||||
|
|
|
@ -69,7 +69,7 @@ class Tags extends Component {
|
|||
|
||||
render() {
|
||||
|
||||
const {name, value, label} = this.props;
|
||||
const {name, /* value, */ label} = this.props;
|
||||
|
||||
return (
|
||||
<div className="form-group row">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
import DateTimePicker from 'react-datetime';
|
||||
import moment from 'moment';
|
||||
// import moment from 'moment';
|
||||
|
||||
class DateTime extends Component {
|
||||
// when the datetime picker mounts, NovaForm will catch the date value (no formsy mixin in this component)
|
||||
|
|
|
@ -4,7 +4,7 @@ import FRC from 'formsy-react-components';
|
|||
|
||||
import DateTime from './DateTime.jsx';
|
||||
|
||||
import Utils from './utils.js';
|
||||
// import Utils from './utils.js';
|
||||
|
||||
const Checkbox = FRC.Checkbox;
|
||||
// const CheckboxGroup = FRC.CheckboxGroup;
|
||||
|
@ -30,7 +30,7 @@ class FormComponent extends Component {
|
|||
renderComponent() {
|
||||
|
||||
// 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;
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ class NovaForm extends Component{
|
|||
// backward compatibility from 'autoform' to 'form'
|
||||
if (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
|
||||
|
@ -291,7 +291,7 @@ class NovaForm extends Component{
|
|||
|
||||
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})
|
||||
// add error to state
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable react/display-name */
|
||||
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
|
||||
if (typeof SimpleSchema !== "undefined") {
|
||||
SimpleSchema.extendOptions({
|
||||
control: Match.Optional(Match.Any), // NovaForm control (String or React component)
|
||||
|
|
|
@ -92,7 +92,7 @@ var createDummyComments = function () {
|
|||
|
||||
};
|
||||
|
||||
deleteDummyContent = function () {
|
||||
var deleteDummyContent = function () {
|
||||
Users.remove({'profile.isDummy': true});
|
||||
Posts.remove({isDummy: true});
|
||||
Comments.remove({isDummy: true});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* global InjectData */
|
||||
|
||||
Meteor.startup(function() {
|
||||
var dom = $('script[type="text/inject-data"]', document);
|
||||
var injectedDataString = $.trim(dom.text());
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
/* eslint-disable */
|
||||
|
||||
InjectData = {};
|
|
@ -1,4 +1,6 @@
|
|||
var http = Npm.require('http');
|
||||
/* global InjectData */
|
||||
|
||||
// var http = Npm.require('http');
|
||||
|
||||
var templateText = Assets.getText('lib/inject.html');
|
||||
var injectDataTemplate = _.template(templateText);
|
||||
|
@ -43,7 +45,7 @@ InjectData._hijackWriteIfNeeded = function(res) {
|
|||
'warn: injecting data turned off due to CORS headers. ' +
|
||||
'read more: http://goo.gl/eGwb4e';
|
||||
|
||||
console.warn(warnMessage);
|
||||
console.warn(warnMessage); // eslint-disable-line
|
||||
originalWrite.call(res, chunk, encoding);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* global InjectData */
|
||||
|
||||
InjectData._encode = function(ejson) {
|
||||
var ejsonString = EJSON.stringify(ejson);
|
||||
return encodeURIComponent(ejsonString);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var fs = Npm.require('fs');
|
||||
var path = Npm.require('path');
|
||||
// var fs = Npm.require('fs');
|
||||
// var path = Npm.require('path');
|
||||
|
||||
// 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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import { Kadira } from 'meteor/meteorhacks:kadira';
|
||||
|
||||
Meteor.startup(function() {
|
||||
if(process.env.NODE_ENV === "production" && !!Telescope.settings.get('kadiraAppId') && !!Telescope.settings.get('kadiraAppSecret')){
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import Telescope from './config.js';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
|
||||
/**
|
||||
* @summary Kick off the global namespace for Telescope.
|
||||
* @namespace Telescope
|
||||
*/
|
||||
|
||||
Telescope = {};
|
||||
const Telescope = {};
|
||||
|
||||
Telescope.VERSION = '0.27.4-nova';
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable */
|
||||
// see https://gist.github.com/furf/3208381
|
||||
|
||||
_.mixin({
|
||||
|
|
|
@ -89,7 +89,7 @@ Telescope.utils.capitalise = function(str) {
|
|||
|
||||
Telescope.utils.t = function(message) {
|
||||
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) {
|
||||
|
@ -239,7 +239,7 @@ Telescope.utils.checkNested = function(obj /*, level1, level2, ... levelN*/) {
|
|||
|
||||
Telescope.log = function (s) {
|
||||
if(Telescope.settings.get('debug', false) || process.env.NODE_ENV === "development") {
|
||||
console.log(s);
|
||||
console.log(s); // eslint-disable-line
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import Users from 'meteor/nova:users';
|
|||
function subscribeUserOnProfileCompletion (user) {
|
||||
if (!!Telescope.settings.get('autoSubscribe') && !!Users.getEmail(user)) {
|
||||
MailChimpList.add(user, false, function (error, result) {
|
||||
console.log(error);
|
||||
console.log(result);
|
||||
console.log(error); // eslint-disable-line
|
||||
console.log(result); // eslint-disable-line
|
||||
});
|
||||
}
|
||||
return user;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Newsletter from '../namespace.js';
|
||||
import { SyncedCron } from 'meteor/percolatestudio:synced-cron';
|
||||
import moment from 'moment';
|
||||
import Newsletter from '../namespace.js';
|
||||
|
||||
const defaultFrequency = [1]; // every monday
|
||||
const defaultTime = '00:00'; // GMT
|
||||
|
@ -45,7 +46,7 @@ var getSchedule = function (parser) {
|
|||
Meteor.methods({
|
||||
getNextJob: function () {
|
||||
var nextJob = SyncedCron.nextScheduledAtDate('scheduleNewsletter');
|
||||
console.log(nextJob);
|
||||
console.log(nextJob); // eslint-disable-line
|
||||
return nextJob;
|
||||
}
|
||||
});
|
||||
|
@ -60,8 +61,8 @@ var addJob = function () {
|
|||
job: function() {
|
||||
// only schedule newsletter campaigns in production
|
||||
if (process.env.NODE_ENV === "production" || Telescope.settings.get("enableNewsletterInDev", false)) {
|
||||
console.log("// Scheduling newsletter…")
|
||||
console.log(new Date());
|
||||
console.log("// Scheduling newsletter…"); // eslint-disable-line
|
||||
console.log(new Date()); // eslint-disable-line
|
||||
Newsletter.scheduleNextWithMailChimp();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ const MailChimp = function ( apiKey, options ) {
|
|||
|
||||
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(
|
||||
'No API Key',
|
||||
|
|
|
@ -30,7 +30,7 @@ MailChimpList.add = function(userOrEmail, confirm, done){
|
|||
|
||||
try {
|
||||
|
||||
console.log('// Adding "'+email+'" to MailChimp list…');
|
||||
console.log('// Adding "'+email+'" to MailChimp list…'); // eslint-disable-line
|
||||
|
||||
var api = new MailChimp(apiKey);
|
||||
var subscribeOptions = {
|
||||
|
@ -47,7 +47,7 @@ MailChimpList.add = function(userOrEmail, confirm, done){
|
|||
Users.methods.setSetting(user._id, 'newsletter.subscribed', true);
|
||||
}
|
||||
|
||||
console.log("// User subscribed");
|
||||
console.log("// User subscribed"); // eslint-disable-line
|
||||
|
||||
return subscribe;
|
||||
|
||||
|
@ -55,7 +55,7 @@ MailChimpList.add = function(userOrEmail, confirm, done){
|
|||
throw new Meteor.Error("subscription-failed", error.message);
|
||||
}
|
||||
} 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 {
|
||||
|
||||
console.log('// Removing "'+email+'" from MailChimp list…');
|
||||
console.log('// Removing "'+email+'" from MailChimp list…'); // eslint-disable-line
|
||||
|
||||
var api = new MailChimp(apiKey);
|
||||
var subscribeOptions = {
|
||||
|
@ -89,7 +89,7 @@ MailChimpList.remove = (user) => {
|
|||
// mark user as unsubscribed
|
||||
Users.methods.setSetting(user._id, 'newsletter.subscribed', false);
|
||||
|
||||
console.log("// User unsubscribed");
|
||||
console.log("// User unsubscribed"); // eslint-disable-line
|
||||
|
||||
return subscribe;
|
||||
|
||||
|
@ -97,7 +97,7 @@ MailChimpList.remove = (user) => {
|
|||
throw new Meteor.Error("unsubscription-failed", error.message);
|
||||
}
|
||||
} 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");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
/* eslint-disable no-console */
|
||||
|
||||
// newsletter scheduling with MailChimp
|
||||
|
||||
import Telescope from 'meteor/nova:lib';
|
||||
import Newsletter from '../../namespace.js';
|
||||
import MailChimp from './mailchimp_api.js';
|
||||
import Posts from 'meteor/nova:posts';
|
||||
import NovaEmail from 'meteor/nova:email';
|
||||
import htmlToText from 'html-to-text';
|
||||
import moment from 'moment';
|
||||
import Newsletter from '../../namespace.js';
|
||||
import MailChimp from './mailchimp_api.js';
|
||||
|
||||
const defaultPosts = 5;
|
||||
|
||||
|
@ -68,14 +71,14 @@ Newsletter.scheduleWithMailChimp = function (campaign, isTest = false) {
|
|||
};
|
||||
|
||||
// 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(schedule)
|
||||
|
||||
// if this is not a test, mark posts as sent
|
||||
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
|
||||
var confirmationHtml = NovaEmail.getTemplate('newsletterConfirmation')({
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import moment from 'moment';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import Comments from "meteor/nova:comments";
|
||||
import Users from 'meteor/nova:users';
|
||||
import Categories from "meteor/nova:categories";
|
||||
import NovaEmail from 'meteor/nova:email';
|
||||
import { SyncedCron } from 'meteor/percolatestudio:synced-cron';
|
||||
import moment from 'moment';
|
||||
import Newsletter from '../namespace.js';
|
||||
|
||||
// create new "newsletter" view for all posts from the past X days that haven't been scheduled yet
|
||||
|
|
|
@ -21,7 +21,7 @@ Telescope.notifications.create = (userIds, notificationName, data) => {
|
|||
if (!!userEmail) {
|
||||
NovaEmail.buildAndSendHTML(Users.getEmail(user), subject, html);
|
||||
} 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
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -360,7 +360,7 @@ Telescope.callbacks.add("posts.edit.sync", PostsEditSetPostedAt);
|
|||
// ------------------------------------- posts.edit.async -------------------------------- //
|
||||
|
||||
function PostsEditRunPostApprovedCallbacks (post, oldPost) {
|
||||
var now = new Date();
|
||||
// var now = new Date();
|
||||
|
||||
if (Posts.isApproved(post) && !Posts.isApproved(oldPost)) {
|
||||
Telescope.callbacks.runAsync("posts.approve.async", post);
|
||||
|
@ -388,7 +388,7 @@ Telescope.callbacks.add("posts.approve.async", PostsApprovedNotification);
|
|||
|
||||
function UsersRemoveDeletePosts (user, options) {
|
||||
if (options && options.deletePosts) {
|
||||
Posts.remove({userId: userId});
|
||||
Posts.remove({userId: user._id});
|
||||
} else {
|
||||
// not sure if anything should be done in that scenario yet
|
||||
// Posts.update({userId: userId}, {$set: {author: "\[deleted\]"}}, {multi: true});
|
||||
|
|
|
@ -4,7 +4,7 @@ const returnEmptyObject = function () {
|
|||
return {};
|
||||
}
|
||||
|
||||
console.log(Mongo)
|
||||
console.log(Mongo); // eslint-disable-line
|
||||
|
||||
const Mongo = typeof Mongo !== "undefined" ? Mongo : {
|
||||
Collection: function () {
|
||||
|
@ -12,8 +12,8 @@ const Mongo = typeof Mongo !== "undefined" ? Mongo : {
|
|||
}
|
||||
};
|
||||
|
||||
console.log("// Mongo")
|
||||
console.log(Mongo)
|
||||
console.log("// Mongo"); // eslint-disable-line
|
||||
console.log(Mongo); // eslint-disable-line
|
||||
|
||||
const Meteor = typeof Meteor !== "undefined" ? Meteor : {
|
||||
methods: returnEmptyObject
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Posts from './collection.js'
|
||||
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'
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Posts from './collection.js'
|
||||
import { Injected } from 'meteor/meteorhacks:inject-initial';
|
||||
import moment from 'moment';
|
||||
import Posts from './collection.js'
|
||||
|
||||
/**
|
||||
* @summary Parameter callbacks let you add parameters to subscriptions
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Posts from './collection.js';
|
||||
import Users from 'meteor/nova:users';
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import Posts from './collection.js';
|
||||
|
||||
/**
|
||||
* @summary Posts config namespace
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { SyncedCron } from 'meteor/percolatestudio:synced-cron';
|
||||
// import moment from 'moment';
|
||||
import Posts from '../collection.js';
|
||||
import moment from 'moment';
|
||||
|
||||
SyncedCron.options = {
|
||||
log: true,
|
||||
|
@ -28,7 +29,7 @@ const addJob = function () {
|
|||
Posts.update({_id: {$in: postsIds}}, {$set: {isFuture: false}}, {multi: true});
|
||||
|
||||
// log the action
|
||||
console.log('// Scheduled posts approved:', postsIds);
|
||||
console.log('// Scheduled posts approved:', postsIds); // eslint-disable-line
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Posts from '../collection.js';
|
||||
// import Comments from "meteor/nova:comments";
|
||||
import Users from 'meteor/nova:users';
|
||||
import { Counts } from 'meteor/tmeasday:publish-counts';
|
||||
import Posts from '../collection.js';
|
||||
|
||||
Posts._ensureIndex({"status": 1, "postedAt": 1});
|
||||
|
||||
|
@ -112,7 +113,7 @@ Meteor.publish('posts.single', function (terms) {
|
|||
const users = getSinglePostUsers(post);
|
||||
return Users.canView(currentUser, post) ? [posts, users] : [];
|
||||
} 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 [];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Posts from '../collection.js';
|
||||
import { Picker } from 'meteor/meteorhacks:picker';
|
||||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
import Posts from '../collection.js';
|
||||
|
||||
Picker.route('/out', function(params, req, res, next) {
|
||||
var query = params.query;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import Users from 'meteor/nova:users';
|
||||
import Posts from './collection.js'
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { Picker } from 'meteor/meteorhacks:picker';
|
||||
import { servePostRSS, serveCommentRSS } from './rss.js';
|
||||
|
||||
Picker.route('/feed.xml', function(params, req, res, next) {
|
||||
|
|
|
@ -52,7 +52,7 @@ const serveCommentRSS = function (terms, url) {
|
|||
var feed = new RSS(getMeta(url));
|
||||
|
||||
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({
|
||||
title: 'Comment on ' + post.title,
|
||||
description: `${comment.body}</br></br><a href="${comment.getPageUrl(true)}">Discuss</a>`,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Users from 'meteor/nova:users';
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
|
||||
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
|
||||
|
|
|
@ -16,7 +16,7 @@ Meteor.methods({
|
|||
"settings.exportToJSON": function () {
|
||||
if (Users.isAdminById(this.userId)) {
|
||||
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();
|
||||
delete settings._id;
|
||||
settings.public = {};
|
||||
|
@ -26,7 +26,7 @@ Meteor.methods({
|
|||
delete settings[key];
|
||||
}
|
||||
});
|
||||
console.log(JSON.stringify(settings, null, 2));
|
||||
console.log(JSON.stringify(settings, null, 2)); // eslint-disable-line
|
||||
return settings;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import PublicationUtils from 'meteor/utilities:smart-publications';
|
||||
import Users from "meteor/nova:users";
|
||||
import Users from 'meteor/nova:users';
|
||||
|
||||
Users.addField([
|
||||
{
|
||||
|
|
|
@ -132,6 +132,7 @@ const performSubscriptionAction = (action, collection, itemId, user) => {
|
|||
* @summary Generate methods 'collection.subscribe' & 'collection.unsubscribe' automatically
|
||||
* @params {Array[Collections]} collections
|
||||
*/
|
||||
let subscribeMethodsGenerator;
|
||||
export default subscribeMethodsGenerator = (collection) => {
|
||||
|
||||
// generic method function calling the performSubscriptionAction
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import Users from 'meteor/nova:users';
|
||||
|
||||
if (typeof Package['nova:posts'] !== "undefined") {
|
||||
import Posts from "meteor/nova:posts";
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { Gravatar } from 'meteor/jparker:gravatar';
|
||||
import Users from './collection.js';
|
||||
|
||||
// var _ = require('underscore');
|
||||
|
@ -191,7 +192,7 @@ Users.avatar = {
|
|||
return service[0];
|
||||
},
|
||||
|
||||
computeUrl: function(prop) {
|
||||
computeUrl: function(prop, user) {
|
||||
if (typeof prop === 'function') {
|
||||
prop = prop.call(user);
|
||||
}
|
||||
|
@ -210,9 +211,9 @@ Users.avatar = {
|
|||
|
||||
var customProp = user && this.options.customImageProperty;
|
||||
if (typeof customProp === 'function') {
|
||||
return this.computeUrl(customProp);
|
||||
return this.computeUrl(customProp, user);
|
||||
} 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 secure = true;
|
||||
// var secure = true;
|
||||
var options = {
|
||||
// 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
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Users from './collection.js';
|
||||
import marked from 'marked';
|
||||
import Events from "meteor/nova:events";
|
||||
import NovaEmail from 'meteor/nova:email';
|
||||
import { Gravatar } from 'meteor/jparker:gravatar';
|
||||
import marked from 'marked';
|
||||
import Users from './collection.js';
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Collection Hooks //
|
||||
|
|
|
@ -39,7 +39,7 @@ Users.getUserName = function (user) {
|
|||
return user.services.twitter.screenName;
|
||||
}
|
||||
catch (error){
|
||||
console.log(error);
|
||||
console.log(error); // eslint-disable-line
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Users from './collection.js';
|
||||
|
||||
/*
|
||||
var completeUserProfile = function (userId, modifier, user) {
|
||||
|
||||
Users.update(userId, modifier);
|
||||
|
@ -10,6 +11,7 @@ var completeUserProfile = function (userId, modifier, user) {
|
|||
return Users.findOne(userId);
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
Users.methods = {};
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import Users from './collection.js';
|
||||
|
||||
const adminGroup = {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue