Merge branch 'justinr1234-vulcan-updates-jan-2018' into devel

This commit is contained in:
SachaG 2018-01-27 12:32:46 +09:00
commit 3466d552a4
101 changed files with 401 additions and 237 deletions

View file

@ -125,6 +125,7 @@ class CommentsItem extends PureComponent {
CommentsItem.propTypes = {
comment: PropTypes.object.isRequired, // the current comment
currentUser: PropTypes.object,
flash: PropTypes.func,
};
CommentsItem.contextTypes = {
@ -132,4 +133,4 @@ CommentsItem.contextTypes = {
intl: intlShape
};
registerComponent('CommentsItem', CommentsItem);
registerComponent('CommentsItem', CommentsItem, withMessages);

View file

@ -1,8 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import { withCurrentUser, getSetting, registerSetting, Components, registerComponent } from 'meteor/vulcan:core';
import { withCurrentUser, getSetting, Components, registerComponent } from 'meteor/vulcan:core';
import { Posts } from '../../modules/posts/index.js';
const Header = (props, context) => {
const Header = (props) => {
const logoUrl = getSetting('logoUrl');
const siteTitle = getSetting('title', 'My App');
@ -25,7 +26,9 @@ const Header = (props, context) => {
</div>
<div className="nav-new-post">
<Components.PostsNewButton/>
<Components.ShowIf check={Posts.options.mutations.new.check}>
<Components.PostsNewButton/>
</Components.ShowIf>
</div>
</div>

View file

@ -1,4 +1,4 @@
import { Components, registerComponent, withCurrentUser, withMutation, withMessages, Utils } from 'meteor/vulcan:core';
import { Components, registerComponent, withCurrentUser, withMutation, withMessages } from 'meteor/vulcan:core';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, intlShape } from 'meteor/vulcan:i18n';

View file

@ -2,7 +2,6 @@ import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'meteor/vulcan:i18n';
import { withList, withCurrentUser, Components, registerComponent, Utils } from 'meteor/vulcan:core';
import { Comments } from '../../modules/comments/index.js';
const PostsCommentsThread = (props, /* context*/) => {
@ -47,7 +46,7 @@ PostsCommentsThread.propTypes = {
};
const options = {
collection: Comments,
collectionName: 'Comments',
queryName: 'commentsListQuery',
fragmentName: 'CommentsList',
limit: 0,

View file

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import moment from 'moment';
import { FormattedMessage } from 'meteor/vulcan:i18n';
import { Posts } from '../../modules/posts/index.js';
import { withCurrentUser, withList, getSetting, registerSetting, Components, getRawComponent, registerComponent } from 'meteor/vulcan:core';
import { withCurrentUser, withList, getSetting, Components, getRawComponent, registerComponent } from 'meteor/vulcan:core';
class PostsDailyList extends PureComponent {

View file

@ -1,6 +1,6 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Components, registerComponent, getFragment, withMessages, withCurrentUser } from 'meteor/vulcan:core';
import { Components, registerComponent, withMessages, withCurrentUser } from 'meteor/vulcan:core';
import { intlShape } from 'meteor/vulcan:i18n';
import { Posts } from '../../modules/posts/index.js';
import Users from "meteor/vulcan:users";

View file

@ -1,14 +1,32 @@
import { Components, registerComponent, getRawComponent, getFragment, withMessages } from 'meteor/vulcan:core';
import {
Components,
registerComponent,
getRawComponent,
getFragment,
withMessages,
withList,
} from 'meteor/vulcan:core';
import { Posts } from '../../modules/posts/index.js';
import React from 'react';
import PropTypes from 'prop-types';
import { intlShape, FormattedMessage } from 'meteor/vulcan:i18n';
import { withRouter } from 'react-router'
const PostsNewForm = (props, context) =>
<Components.ShowIf
const PostsNewForm = (props, context) => {
if (props.loading) {
return <div className="posts-new-form"><Components.Loading/></div>;
}
return (
<Components.ShowIf
check={Posts.options.mutations.new.check}
failureComponent={<div><p className="posts-new-form-message"><FormattedMessage id="posts.sign_up_or_log_in_first" /></p><Components.AccountsLoginForm /></div>}
failureComponent={
<div>
<p className="posts-new-form-message">
<FormattedMessage id="posts.sign_up_or_log_in_first" />
</p>
<Components.AccountsLoginForm />
</div>
}
>
<div className="posts-new-form">
<Components.SmartForm
@ -22,6 +40,8 @@ const PostsNewForm = (props, context) =>
/>
</div>
</Components.ShowIf>
);
};
PostsNewForm.propTypes = {
closeModal: PropTypes.func,
@ -37,4 +57,12 @@ PostsNewForm.contextTypes = {
PostsNewForm.displayName = "PostsNewForm";
registerComponent('PostsNewForm', PostsNewForm, withRouter, withMessages);
const options = {
collectionName: 'Categories',
queryName: 'categoriesListQuery',
fragmentName: 'CategoriesList',
limit: 0,
pollInterval: 0,
};
registerComponent('PostsNewForm', PostsNewForm, withRouter, withMessages, [withList, options]);

View file

@ -15,7 +15,7 @@ class PostsPage extends Component {
} else if (!this.props.document) {
console.log(`// missing post (_id: ${this.props.documentId})`);
// console.log(`// missing post (_id: ${this.props.documentId})`);
return <div className="posts-page"><FormattedMessage id="app.404"/></div>
} else {

View file

@ -24,9 +24,13 @@ const UsersMenu = ({currentUser, client}) =>
<MenuItem className="dropdown-item" eventKey="2"><FormattedMessage id="users.edit_account"/></MenuItem>
</LinkContainer>
<LinkContainer to={`/admin`}>
<MenuItem className="dropdown-item" eventKey="2">Admin</MenuItem>
</LinkContainer>
<Components.ShowIf
check={() => Users.isAdmin(currentUser)}
>
<LinkContainer to={`/admin`}>
<MenuItem className="dropdown-item" eventKey="2">Admin</MenuItem>
</LinkContainer>
</Components.ShowIf>
<MenuItem className="dropdown-item" eventKey="4" onClick={() => Meteor.logout(() => client.resetStore())}><FormattedMessage id="users.log_out"/></MenuItem>
</Dropdown.Menu>
</Dropdown>

View file

@ -11,7 +11,7 @@ const UsersProfile = (props) => {
} else if (!props.document) {
console.log(`// missing user (_id/slug: ${props.documentId || props.slug})`);
// console.log(`// missing user (_id/slug: ${props.documentId || props.slug})`);
return <div className="page users-profile"><FormattedMessage id="app.404"/></div>
} else {

View file

@ -4,7 +4,7 @@ Categories parameter
*/
import { addCallback, getSetting, registerSetting, getFragment, runQuery } from 'meteor/vulcan:core';
import { addCallback, getSetting, registerSetting } from 'meteor/vulcan:core';
import gql from 'graphql-tag';
import { Categories } from './collection.js';
@ -25,7 +25,7 @@ function PostsCategoryParameter(parameters, terms, apolloClient) {
// note: specify all arguments, see https://github.com/apollographql/apollo-client/issues/2051
const query = `
query GetCategories($terms: JSON) {
CategoriesList(terms: $terms) {
CategoriesList(terms: $terms, enableCache: $enableCache) {
_id
slug
}
@ -36,7 +36,7 @@ function PostsCategoryParameter(parameters, terms, apolloClient) {
// get categories from Redux store
allCategories = apolloClient.readQuery({
query: gql`${query}`,
variables: {terms: {limit: 0, itemsPerPage: 0}}
variables: {terms: {limit: 0, itemsPerPage: 0}, enableCache: false}
}).CategoriesList;
} else {
// TODO: figure out how to make this async without messing up withList on the client

View file

@ -6,8 +6,8 @@ import './routes.js';
import './headtags.js';
import './i18n.js';
export { Posts } from './posts/index.js';
export { Categories } from './categories/index.js';
export { Comments } from './comments/index.js';
export { Posts } from './posts/index.js';
import './notifications/index.js';

View file

@ -84,8 +84,10 @@ VulcanEmail.addEmails({
function MarkPostsAsScheduled (email) {
const postsIds = _.pluck(email.data.PostsList, '_id');
// eslint-disable-next-line no-console
console.log(postsIds)
const updated = Posts.update({_id: {$in: postsIds}}, {$set: {scheduledAt: new Date()}}, {multi: true}) // eslint-disable-line
// eslint-disable-next-line no-console
console.log(`updated ${updated} posts`)
}
addCallback('newsletter.send.async', MarkPostsAsScheduled);

View file

@ -4,7 +4,7 @@ Callbacks to add media/thumbnail after submit and on edit
*/
import { addCallback, getSetting, registerSetting } from 'meteor/vulcan:core';
import { addCallback, getSetting } from 'meteor/vulcan:core';
import Embed from 'meteor/vulcan:embed';
const embedProvider = getSetting('embedProvider');
@ -74,6 +74,8 @@ function updateMediaOnEdit (modifier, post) {
}
addCallback('posts.edit.sync', updateMediaOnEdit);
const addMediaAfterSubmit = AddMediaAfterSubmit;
const regenerateThumbnail = function (post) {
delete post.thumbnailUrl;
delete post.media;

View file

@ -31,9 +31,12 @@ Picker.route('/out', ({ query}, req, res, next) => {
res.end(`Invalid URL: ${query.url}`);
}
} catch (error) {
console.log('// /out error')
console.log(error)
console.log(query)
// eslint-disable-next-line no-console
console.log('// /out error');
// eslint-disable-next-line no-console
console.log(error);
// eslint-disable-next-line no-console
console.log(query);
}
} else {
res.end("Please provide a URL");

View file

@ -69,10 +69,12 @@ if (getSetting('forum.seedOnStart')) {
});
// Categories.insert(category);
// eslint-disable-next-line no-console
console.log(`// Creating category “${category.name}`); // eslint-disable-line
}
});
} else if (!Categories.find().count()) {
// eslint-disable-next-line no-console
console.log('// inserting dummy categories');
// else if there are no categories yet, create dummy categories
dummyCategories.forEach(category => {

View file

@ -1,3 +1,4 @@
/* global Vulcan */
import { newMutation, registerSetting, getSetting } from 'meteor/vulcan:core';
import moment from 'moment';
import { Posts } from '../../modules/posts/index.js';
@ -96,6 +97,7 @@ if (getSetting('forum.seedOnStart')) {
}
var createDummyUsers = function () {
// eslint-disable-next-line no-console
console.log('// inserting dummy users…');
createUser('Bruce', 'dummyuser1@telescopeapp.org');
createUser('Arnold', 'dummyuser2@telescopeapp.org');
@ -103,6 +105,7 @@ if (getSetting('forum.seedOnStart')) {
};
var createDummyPosts = function () {
// eslint-disable-next-line no-console
console.log('// inserting dummy posts');
createPost("read_this_first", moment().toDate(), "Bruce", "telescope.png");
@ -118,6 +121,7 @@ if (getSetting('forum.seedOnStart')) {
};
var createDummyComments = function () {
// eslint-disable-next-line no-console
console.log('// inserting dummy comments…');
createComment("read_this_first", "Bruce", "What an awesome app!");
@ -137,6 +141,7 @@ if (getSetting('forum.seedOnStart')) {
Posts.remove({isDummy: true});
Comments.remove({isDummy: true});
Categories.remove({isDummy: true});
// eslint-disable-next-line no-console
console.log('// Getting started content removed');
};

View file

@ -8,7 +8,7 @@ to check if the user has the proper permissions to actually insert a new picture
*/
import React from 'react';
import { Components, registerComponent, withCurrentUser, getFragment } from 'meteor/vulcan:core';
import { Components, registerComponent, getFragment } from 'meteor/vulcan:core';
import Pics from '../../modules/pics/collection.js';

View file

@ -8,7 +8,6 @@ import Pics from '../modules/pics/collection.js';
import Comments from '../modules/comments/collection.js';
import Users from 'meteor/vulcan:users';
import { newMutation } from 'meteor/vulcan:core';
import { Accounts } from 'meteor/accounts-base';
import moment from 'moment';
const dummyFlag = {
@ -77,6 +76,7 @@ const createUser = function (username, email) {
}
var createDummyUsers = function () {
// eslint-disable-next-line no-console
console.log('// inserting dummy users…');
createUser('Bruce', 'dummyuser1@telescopeapp.org');
createUser('Arnold', 'dummyuser2@telescopeapp.org');
@ -84,6 +84,7 @@ var createDummyUsers = function () {
};
const createDummyPics = function () {
// eslint-disable-next-line no-console
console.log('// creating dummy pics…');
createPic('cherry_blossoms.jpg', moment().toDate(), `Kyoto's cherry blossoms`, 'Bruce');
createPic('koyo.jpg', moment().subtract(10, 'minutes').toDate(), `Red maple leaves during Fall.`, 'Arnold');
@ -97,6 +98,7 @@ const createDummyPics = function () {
};
const createDummyComments = function () {
// eslint-disable-next-line no-console
console.log('// creating dummy comments');
createComment('Bruce', 'Great job.');
createComment('Arnold', 'I would love to go there…');

View file

@ -72,6 +72,7 @@ const createUser = function (username, email) {
}
var createDummyUsers = function () {
// eslint-disable-next-line no-console
console.log('// inserting dummy users…');
createUser('Bruce', 'dummyuser1@telescopeapp.org');
createUser('Arnold', 'dummyuser2@telescopeapp.org');
@ -84,6 +85,7 @@ Meteor.startup(function () {
}
const currentUser = Users.findOne(); // just get the first user available
if (Categories.find().fetch().length === 0) {
// eslint-disable-next-line no-console
console.log('// creating dummy categories');
seedData.forEach(document => {
newMutation({

View file

@ -11,7 +11,6 @@ Note: the Helmet library is used to insert meta tags and link tags in the <head>
import React from 'react';
import Helmet from 'react-helmet';
import Header from './Header.jsx';
import { replaceComponent, Components } from 'meteor/vulcan:core';
// note: modal popups won't work with anything above bootstrap alpha.5.

View file

@ -8,7 +8,7 @@ to check if the user has the proper permissions to actually insert a new picture
*/
import React from 'react';
import { Components, registerComponent, withCurrentUser, getFragment } from 'meteor/vulcan:core';
import { Components, registerComponent, getFragment } from 'meteor/vulcan:core';
import Pics from '../../modules/pics/collection.js';

View file

@ -7,7 +7,6 @@ Seed the database with some dummy content.
import Pics from '../modules/pics/collection.js';
import Users from 'meteor/vulcan:users';
import { newMutation } from 'meteor/vulcan:core';
import { Accounts } from 'meteor/accounts-base';
import moment from 'moment';
const dummyFlag = {
@ -56,6 +55,7 @@ const createUser = function (username, email) {
}
var createDummyUsers = function () {
// eslint-disable-next-line no-console
console.log('// inserting dummy users…');
createUser('Bruce', 'dummyuser1@telescopeapp.org');
createUser('Arnold', 'dummyuser2@telescopeapp.org');
@ -63,6 +63,7 @@ var createDummyUsers = function () {
};
const createDummyPics = function () {
// eslint-disable-next-line no-console
console.log('// creating dummy pics…');
createPic('cherry_blossoms.jpg', moment().toDate(), `Kyoto's cherry blossoms`, 'Bruce');
createPic('koyo.jpg', moment().subtract(10, 'minutes').toDate(), `Red maple leaves during Fall.`, 'Arnold');

View file

@ -69,6 +69,7 @@ const createUser = function (username, email) {
}
var createDummyUsers = function () {
// eslint-disable-next-line no-console
console.log('// inserting dummy users…');
createUser('Bruce', 'dummyuser1@telescopeapp.org');
createUser('Arnold', 'dummyuser2@telescopeapp.org');
@ -81,6 +82,7 @@ Meteor.startup(function () {
}
const currentUser = Users.findOne(); // just get the first user available
if (Movies.find().fetch().length === 0) {
// eslint-disable-next-line no-console
console.log('// creating dummy movies');
seedData.forEach(document => {
newMutation({

View file

@ -8,7 +8,6 @@ import Pics from '../modules/pics/collection.js';
import Comments from '../modules/comments/collection.js';
import Users from 'meteor/vulcan:users';
import { newMutation } from 'meteor/vulcan:core';
import { Accounts } from 'meteor/accounts-base';
import moment from 'moment';
const dummyFlag = {
@ -77,6 +76,7 @@ const createUser = function (username, email) {
}
var createDummyUsers = function () {
// eslint-disable-next-line no-console
console.log('// inserting dummy users…');
createUser('Bruce', 'dummyuser1@telescopeapp.org');
createUser('Arnold', 'dummyuser2@telescopeapp.org');
@ -84,6 +84,7 @@ var createDummyUsers = function () {
};
const createDummyPics = function () {
// eslint-disable-next-line no-console
console.log('// creating dummy pics…');
createPic('cherry_blossoms.jpg', moment().toDate(), `Kyoto's cherry blossoms`, 'Bruce');
createPic('koyo.jpg', moment().subtract(10, 'minutes').toDate(), `Red maple leaves during Fall.`, 'Arnold');
@ -97,6 +98,7 @@ const createDummyPics = function () {
};
const createDummyComments = function () {
// eslint-disable-next-line no-console
console.log('// creating dummy comments');
createComment('Bruce', 'Great job.');
createComment('Arnold', 'I would love to go there…');

View file

@ -69,6 +69,7 @@ const createUser = function (username, email) {
}
var createDummyUsers = function () {
// eslint-disable-next-line no-console
console.log('// inserting dummy users…');
createUser('Bruce', 'dummyuser1@telescopeapp.org');
createUser('Arnold', 'dummyuser2@telescopeapp.org');
@ -81,6 +82,7 @@ Meteor.startup(function () {
}
const currentUser = Users.findOne(); // just get the first user available
if (Movies.find().fetch().length === 0) {
// eslint-disable-next-line no-console
console.log('// creating dummy movies');
seedData.forEach(document => {
newMutation({

View file

@ -70,6 +70,7 @@ const createUser = function (username, email) {
}
var createDummyUsers = function () {
// eslint-disable-next-line no-console
console.log('// inserting dummy users…');
createUser('Bruce', 'dummyuser1@telescopeapp.org');
createUser('Arnold', 'dummyuser2@telescopeapp.org');
@ -82,6 +83,7 @@ Meteor.startup(function () {
}
const currentUser = Users.findOne(); // just get the first user available
if (Movies.find().fetch().length === 0) {
// eslint-disable-next-line no-console
console.log('// creating dummy movies');
seedData.forEach(document => {
newMutation({

View file

@ -1,10 +1,5 @@
import { Accounts } from 'meteor/accounts-base';
import {
redirect,
validatePassword,
validateEmail,
validateUsername,
} from './helpers.js';
import { redirect } from './helpers.js';
/**
* @summary Accounts UI

View file

@ -9,3 +9,4 @@ import './ui/components/LoginForm.jsx';
import './ui/components/PasswordOrService.jsx';
import './ui/components/SocialButtons.jsx';
import './ui/components/ResetPassword.jsx';
import './ui/components/EnrollAccount.jsx';

View file

@ -1,5 +1,9 @@
let browserHistory
try { browserHistory = require('react-router').browserHistory } catch(e) {}
let browserHistory;
try {
browserHistory = require('react-router').browserHistory;
} catch(e) {
// swallow errors
}
export const loginButtonsSession = Accounts._loginButtonsSession;
export const STATES = {
SIGN_IN: Symbol('SIGN_IN'),
@ -21,7 +25,7 @@ export function getLoginServices() {
return _.map(services, function(name){
return {name: name};
});
};
}
// Export getLoginServices using old style globals for accounts-base which
// requires it.
this.getLoginServices = getLoginServices;
@ -29,17 +33,17 @@ this.getLoginServices = getLoginServices;
export function hasPasswordService() {
// First look for OAuth services.
return !!Package['accounts-password'];
};
}
export function loginResultCallback(service, err) {
if (!err) {
// Do nothing
} else if (err instanceof Accounts.LoginCancelledError) {
// do nothing
// Do nothing
} else if (err instanceof ServiceConfiguration.ConfigError) {
// Do nothing
} else {
//loginButtonsSession.errorMessage(err.reason || "Unknown error");
// loginButtonsSession.errorMessage(err.reason || "Unknown error");
}
if (Meteor.isClient) {
@ -51,11 +55,11 @@ export function loginResultCallback(service, err) {
service();
}
}
};
}
export function passwordSignupFields() {
return Accounts.ui._options.passwordSignupFields || "USERNAME_AND_EMAIL";
};
}
export function validateEmail(email, showMessage, clearMessage) {
if (passwordSignupFields() === "USERNAME_AND_OPTIONAL_EMAIL" && email === '') {
@ -80,7 +84,7 @@ export function validatePassword(password = '', showMessage, clearMessage){
showMessage(errMsg, 'warning', false, 'password');
return false;
}
};
}
export function validateUsername(username, showMessage, clearMessage, formState) {
if ( username ) {

View file

@ -1,9 +1,6 @@
import {Accounts} from 'meteor/accounts-base';
import {
STATES,
loginResultCallback,
getLoginServices
} from './helpers.js';
/* eslint-disable meteor/no-session */
import { Accounts } from 'meteor/accounts-base';
import { loginResultCallback, getLoginServices } from './helpers.js';
const VALID_KEYS = [
'dropdownVisible',
@ -72,12 +69,12 @@ if (Meteor.isClient){
loginResultCallback(attemptInfo.type, attemptInfo.error);
});
let doneCallback;
// let doneCallback;
Accounts.onResetPasswordLink(function (token, done) {
Accounts._loginButtonsSession.set('resetPasswordToken', token);
Session.set(KEY_PREFIX + 'state', 'resetPasswordToken');
doneCallback = done;
// doneCallback = done;
Accounts.ui._options.onResetPasswordHook();
});
@ -85,7 +82,7 @@ if (Meteor.isClient){
Accounts.onEnrollmentLink(function (token, done) {
Accounts._loginButtonsSession.set('enrollAccountToken', token);
Session.set(KEY_PREFIX + 'state', 'enrollAccountToken');
doneCallback = done;
// doneCallback = done;
Accounts.ui._options.onEnrollAccountHook();
});

View file

@ -1,3 +1,4 @@
import { addRoute } from 'meteor/vulcan:core';
addRoute({name: 'resetPassword', path: '/reset-password/:token', componentName: 'AccountsResetPassword'});
addRoute({name: 'enrollAccount', path: '/enroll-account/:token', componentName: 'AccountsEnrollAccount'});

View file

@ -8,7 +8,7 @@ export class AccountsButton extends PureComponent {
const {
label,
href = null,
// href = null,
type,
disabled = false,
className,
@ -16,15 +16,15 @@ export class AccountsButton extends PureComponent {
} = this.props;
return type === 'link' ?
<a href="#" className={ className } onClick={ onClick } style={{marginRight: '10px'}}>{ label }</a> :
<a href="#" className={className} onClick={onClick} style={{marginRight: '10px'}}>{label}</a> :
<Button
style={{marginRight: '10px'}}
bsStyle="primary"
className={ className }
type={ type }
disabled={ disabled }
onClick={ onClick }>
{ label }
className={className}
type={type}
disabled={disabled}
onClick={onClick}>
{label}
</Button>;
}
}

View file

@ -13,6 +13,6 @@ export class Buttons extends React.Component {
</div>
);
}
};
}
registerComponent('AccountsButtons', Buttons);

View file

@ -0,0 +1,41 @@
import { Components, registerComponent, withCurrentUser } from 'meteor/vulcan:core';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { intlShape } from 'meteor/vulcan:i18n';
import { STATES } from '../../helpers.js';
class AccountsEnrollAccount extends PureComponent {
componentDidMount() {
const token = this.props.params.token;
Accounts._loginButtonsSession.set('enrollAccountToken', token);
}
render() {
if (!this.props.currentUser) {
return (
<Components.AccountsLoginForm
formState={ STATES.ENROLL_ACCOUNT }
/>
);
} else {
return (
<div className='password-reset-form'>
<div>{this.context.intl.formatMessage({id: 'accounts.info_password_changed'})}!</div>
</div>
);
}
}
}
AccountsEnrollAccount.contextTypes = {
intl: intlShape
}
AccountsEnrollAccount.propsTypes = {
currentUser: PropTypes.object,
params: PropTypes.object,
};
AccountsEnrollAccount.displayName = 'AccountsEnrollAccount';
registerComponent('AccountsEnrollAccount', AccountsEnrollAccount, withCurrentUser);

View file

@ -49,7 +49,7 @@ export class AccountsField extends PureComponent {
label,
type = 'text',
onChange,
required = false,
// required = false,
className = "field",
defaultValue = "",
message,

View file

@ -15,18 +15,16 @@ export class AccountsForm extends PureComponent {
render() {
const {
hasPasswordService,
// hasPasswordService,
oauthServices,
fields,
buttons,
error,
// error,
messages,
ready = true,
className
className,
} = this.props;
const _className = classnames("accounts-ui", {
"ready": ready,
});
const _className = classnames('accounts-ui', { ready }, className);
return (
<form
ref={(ref) => this.form = ref}

View file

@ -6,8 +6,7 @@ export class AccountsFormMessage extends React.Component {
let { message, type, className = "message", style = {} } = this.props;
message = _.isObject(message) ? message.message : message; // If message is object, then try to get message from it
return message ? (
<div style={ style } 
className={[ className, type ].join(' ')}>{ message }</div>
<div style={style} className={[ className, type ].join(' ')}>{ message }</div>
) : null;
}
}

View file

@ -1,14 +1,14 @@
import React, { Component } from 'react';
import React, { Component } from 'react';
import { Components, registerComponent } from 'meteor/vulcan:core';
export class AccountsFormMessages extends Component {
render () {
const { messages = [], className = "messages", style = {} } = this.props;
return messages.length > 0 && (
<div className="messages">
<div className={className} style={style}>
{messages
.filter(message => !('field' in message))
.map(({ message, type }, i) =>
.map(({ message, type }, i) =>
<Components.AccountsFormMessage
message={message}
type={type}

View file

@ -1,9 +1,9 @@
/* eslint-disable meteor/no-session */
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import Tracker from 'tracker-component';
import { Accounts } from 'meteor/accounts-base';
import { KEY_PREFIX } from '../../login_session.js';
import { KEY_PREFIX } from '../../login_session.js';
import { Components, registerComponent, withCurrentUser, Callbacks, runCallbacks } from 'meteor/vulcan:core';
import { intlShape } from 'meteor/vulcan:i18n';
import { withApollo } from 'react-apollo';
@ -25,6 +25,7 @@ export class AccountsLoginForm extends Tracker.Component {
super(props);
if (props.formState === STATES.SIGN_IN && Package['accounts-password']) {
// eslint-disable-next-line no-console
console.warn('Do not force the state to SIGN_IN on Accounts.ui.LoginForm, it will make it impossible to reset password in your app, this state is also the default state if logged out, so no need to force it.');
}
@ -259,7 +260,7 @@ export class AccountsLoginForm extends Tracker.Component {
break;
}
this.setState({ [field]: value });
this.setDefaultFieldValues({ [field]: value });
this.setDefaultFieldValues({ [field]: value });
}
fields() {
@ -608,7 +609,7 @@ export class AccountsLoginForm extends Tracker.Component {
password,
formState,
onSubmitHook
} = this.state;
} = this.state;
let error = false;
let loginSelector;
this.clearMessages();
@ -650,6 +651,7 @@ export class AccountsLoginForm extends Tracker.Component {
Meteor.loginWithPassword(loginSelector, password, (error, result) => {
onSubmitHook(error,formState);
if (error) {
// eslint-disable-next-line no-console
console.log(error);
const errorId = `accounts.error_${error.reason.toLowerCase().replace(/ /g, '_')}`;
if (this.context.intl.formatMessage({id: errorId})) {
@ -691,7 +693,7 @@ export class AccountsLoginForm extends Tracker.Component {
}
oauthSignIn(serviceName) {
const { formState, waiting, currentUser, onSubmitHook } = this.state;
const { formState, /* waiting, currentUser, */ onSubmitHook } = this.state;
//Thanks Josh Owens for this one.
function capitalService() {
return serviceName.charAt(0).toUpperCase() + serviceName.slice(1);
@ -715,7 +717,8 @@ export class AccountsLoginForm extends Tracker.Component {
loginWithService(options, (error) => {
onSubmitHook(error,formState);
if (error) {
console.log(error)
// eslint-disable-next-line no-console
console.log(error);
if (error instanceof Accounts.LoginCancelledError) {
// do nothing
} else {
@ -741,7 +744,7 @@ export class AccountsLoginForm extends Tracker.Component {
const {
username = null,
email = null,
usernameOrEmail = null,
// usernameOrEmail = null,
password,
formState,
onSubmitHook
@ -788,6 +791,7 @@ export class AccountsLoginForm extends Tracker.Component {
const SignUp = function(_options) {
Accounts.createUser(_options, (error) => {
if (error) {
// eslint-disable-next-line no-console
console.log(error);
const errorId = `accounts.error_${error.reason.toLowerCase().replace(/ /g, '_').replace('.','')}`;
@ -824,6 +828,7 @@ export class AccountsLoginForm extends Tracker.Component {
promise.then(SignUp.bind(this, options));
}
else {
// eslint-disable-next-line babel/new-cap
SignUp(options);
}
}
@ -835,7 +840,7 @@ export class AccountsLoginForm extends Tracker.Component {
waiting,
formState,
onSubmitHook
} = this.state;
} = this.state;
if (waiting) {
return;
@ -847,7 +852,8 @@ export class AccountsLoginForm extends Tracker.Component {
this.setState({ waiting: true });
Accounts.forgotPassword({ email: email }, (error) => {
console.log(error)
// eslint-disable-next-line no-console
console.log(error);
if (error) {
const errorId = `accounts.error_${error.reason.toLowerCase().replace(/ /g, '_')}`;
this.showMessage(errorId, 'error');
@ -869,7 +875,7 @@ export class AccountsLoginForm extends Tracker.Component {
formState,
onSubmitHook,
onSignedInHook,
} = this.state;
} = this.state;
if (!this.validateField('password', newPassword)){
onSubmitHook('err.minChar',formState);
@ -916,13 +922,13 @@ export class AccountsLoginForm extends Tracker.Component {
showMessage(messageId, type, clearTimeout, field){
if (messageId) {
this.setState(({ messages = [] }) => {
this.setState(({ messages = [] }) => {
messages.push({
message: this.context.intl.formatMessage({id: messageId}),
type,
...(field && { field }),
...(field && { field }),
});
return { messages };
return { messages };
});
if (clearTimeout) {
this.hideMessageTimout = setTimeout(() => {
@ -934,14 +940,14 @@ export class AccountsLoginForm extends Tracker.Component {
}
getMessageForField(field) {
const { messages = [] } = this.state;
return messages.find(({ field:key }) => key === field);
const { messages = [] } = this.state;
return messages.find(({ field:key }) => key === field);
}
clearMessage(message) {
if (message) {
this.setState(({ messages = [] }) => ({
messages: messages.filter(({ message:a }) => a !== message),
this.setState(({ messages = [] }) => ({
messages: messages.filter(({ message:a }) => a !== message),
}));
}
}
@ -962,16 +968,16 @@ export class AccountsLoginForm extends Tracker.Component {
render() {
this.oauthButtons();
// Backwords compatibility with v1.2.x.
const { messages = [] } = this.state;
const { messages = [] } = this.state;
const message = {
deprecated: true,
message: messages.map(({ message }) => message).join(', '),
message: messages.map(({ message }) => message).join(', '),
};
return (
<Components.AccountsForm
oauthServices={this.oauthButtons()}
fields={this.fields()} 
fields={this.fields()}
buttons={this.buttons()}
{...this.state}
message={message}

View file

@ -17,7 +17,7 @@ export class AccountsPasswordOrService extends PureComponent {
if (hasPasswordService() && services.length > 0) {
return (
<div style={ style } className={ className }>
<div style={style} className={className}>
{ `${this.context.intl.formatMessage({id: 'accounts.or_use'})} ${ labels.join(' / ') }` }
</div>
);

View file

@ -1,7 +1,6 @@
import { Components, registerComponent, withCurrentUser } from 'meteor/vulcan:core';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router';
import { intlShape } from 'meteor/vulcan:i18n';
import { STATES } from '../../helpers.js';

View file

@ -3,7 +3,7 @@ import './imports/accounts_ui.js';
import './imports/components.js';
import './imports/login_session.js';
import './imports/routes.js';
import { STATES } from './imports/helpers.js';
import { STATES } from './imports/helpers.js';
import './imports/ui/components/LoginForm.jsx';

View file

@ -3,7 +3,7 @@ import './imports/accounts_ui.js';
import './imports/components.js';
import './imports/login_session.js';
import './imports/routes.js';
import { redirect, STATES } from './imports/helpers.js';
import { redirect, STATES } from './imports/helpers.js';
import './imports/api/server/servicesListPublication.js';
import './imports/ui/components/LoginForm.jsx';

View file

@ -1,7 +1,6 @@
import {
Components,
registerComponent,
registerSetting,
getSetting,
Strings,
runCallbacks,

View file

@ -5,7 +5,8 @@ const DynamicLoading = ({ isLoading, pastDelay, error }) => {
if (isLoading && pastDelay) {
return <Components.Loading/>;
} else if (error && !isLoading) {
console.log(error)
// eslint-disable-next-line no-console
console.log(error);
return <p>Error!</p>;
} else {
return null;

View file

@ -47,7 +47,7 @@ export default function withDocument (options) {
return graphQLOptions;
},
props: returnedProps => {
const { ownProps, data } = returnedProps;
const { /* ownProps, */ data } = returnedProps;
const propertyName = options.propertyName || 'document';
const props = {

View file

@ -35,11 +35,10 @@ Terms object can have the following properties:
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withApollo, graphql } from 'react-apollo';
import gql from 'graphql-tag';
import update from 'immutability-helper';
import { getSetting, getFragment, getFragmentName } from 'meteor/vulcan:core';
import { getSetting, getFragment, getFragmentName, Collections } from 'meteor/vulcan:core';
import Mingo from 'mingo';
import compose from 'recompose/compose';
import withState from 'recompose/withState';
@ -48,10 +47,19 @@ const withList = (options) => {
// console.log(options)
const { collection, limit = 10, pollInterval = getSetting('pollInterval', 20000), totalResolver = true, enableCache = false, extraQueries } = options,
queryName = options.queryName || `${collection.options.collectionName}ListQuery`,
listResolverName = collection.options.resolvers.list && collection.options.resolvers.list.name,
totalResolverName = collection.options.resolvers.total && collection.options.resolvers.total.name;
const {
collectionName,
limit = 10,
pollInterval = getSetting('pollInterval', 20000),
totalResolver = true,
enableCache = false,
extraQueries,
} = options;
const collection = options.collection
|| Collections.find(({ options: { collectionName: name }}) => name === collectionName );
const queryName = options.queryName || `${collection.options.collectionName}ListQuery`;
const listResolverName = collection.options.resolvers.list && collection.options.resolvers.list.name;
const totalResolverName = collection.options.resolvers.total && collection.options.resolvers.total.name;
let fragment;
@ -146,6 +154,7 @@ const withList = (options) => {
propertyName = options.propertyName || 'results';
if (error) {
// eslint-disable-next-line no-console
console.log(error);
}

View file

@ -1,5 +1,4 @@
import React from 'react';
import { FormattedMessage } from 'meteor/vulcan:i18n';
import { registerComponent, Components } from 'meteor/vulcan:lib';
import Callbacks from '../modules/callbacks/collection.js';

View file

@ -1,5 +1,4 @@
import React from 'react';
import { FormattedMessage } from 'meteor/vulcan:i18n';
import { registerComponent, Components } from 'meteor/vulcan:lib';
import Settings from '../modules/settings/collection.js';

View file

@ -1,3 +1,4 @@
/* eslint-disable no-console */
import VulcanEmail from '../namespace.js';
import Juice from 'juice';
import htmlToText from 'html-to-text';

View file

@ -50,6 +50,7 @@ const extractMeta = function (params) {
}
html = result.content;
} catch (e) {
// eslint-disable-next-line no-console
console.log('catch error', e);
return META;
}

View file

@ -14,6 +14,7 @@ if (settings) {
if(!apiKey) {
// fail silently to still let the post be submitted as usual
// eslint-disable-next-line no-console
console.log("Couldn't find an Embedly API key! Please add it to your Vulcan settings."); // eslint-disable-line
return null;
}
@ -48,8 +49,10 @@ if (settings) {
return embedlyData;
} catch (error) {
console.log('// Embedly error')
console.log(error); // eslint-disable-line
// eslint-disable-next-line no-console
console.log('// Embedly error');
// eslint-disable-next-line no-console
console.log(error);
// the first 13 characters of the Embedly errors are "failed [400] ", so remove them and parse the rest
const errorObject = JSON.parse(error.message.substring(13));
throw new Error(errorObject.error_message);

View file

@ -11,9 +11,12 @@ const resolver = {
Mutation: {
getEmbedData(root, args, context) {
const data = Embed[embedProvider].getData(args.url);
console.log('// getEmbedData')
console.log(args)
console.log(data)
// eslint-disable-next-line no-console
console.log('// getEmbedData');
// eslint-disable-next-line no-console
console.log(args);
// eslint-disable-next-line no-console
console.log(data);
return data;
},
},

View file

@ -1,5 +1,10 @@
import { getSetting, addCallback, Utils } from 'meteor/vulcan:core';
import { addPageFunction, addInitFunction, addIdentifyFunction, addTrackFunction } from 'meteor/vulcan:events';
import { getSetting, /* addCallback, Utils */ } from 'meteor/vulcan:core';
import {
// addPageFunction,
addInitFunction,
addIdentifyFunction,
// addTrackFunction,
} from 'meteor/vulcan:events';
/*
@ -7,6 +12,7 @@ Identify User
*/
function intercomIdentify(currentUser) {
// eslint-disable-next-line no-undef
intercomSettings = {
app_id: getSetting('intercom.appId'),
name: currentUser.displayName,
@ -20,6 +26,7 @@ function intercomIdentify(currentUser) {
var ic = w.Intercom;
if (typeof ic === 'function') {
ic('reattach_activator');
// eslint-disable-next-line no-undef
ic('update', intercomSettings);
} else {
var d = document;
@ -31,11 +38,12 @@ function intercomIdentify(currentUser) {
i.q.push(args);
};
w.Intercom = i;
// eslint-disable-next-line no-inner-declarations
function l() {
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://widget.intercom.io/widget/icygo7se';
s.src = getSetting('intercom.widgetUrl', 'https://widget.intercom.io/widget/icygo7se');
var x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
@ -73,6 +81,7 @@ function intercomInit() {
var ic = w.Intercom;
if (typeof ic === 'function') {
ic('reattach_activator');
// eslint-disable-next-line no-undef
ic('update', intercomSettings);
} else {
var d = document;
@ -84,11 +93,12 @@ function intercomInit() {
i.q.push(args);
};
w.Intercom = i;
// eslint-disable-next-line no-inner-declarations
function l() {
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://widget.intercom.io/widget/icygo7se';
s.src = getSetting('intercom.widgetUrl', 'https://widget.intercom.io/widget/icygo7se');
var x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}

View file

@ -1,6 +1,13 @@
import Intercom from 'intercom-client';
import { getSetting, addCallback, Utils } from 'meteor/vulcan:core';
import { addPageFunction, addUserFunction, addInitFunction, addIdentifyFunction, addTrackFunction } from 'meteor/vulcan:events';
import { getSetting, /* addCallback, Utils */ } from 'meteor/vulcan:core';
import {
// addPageFunction,
addUserFunction,
// addInitFunction,
// addIdentifyFunction,
addTrackFunction,
} from 'meteor/vulcan:events';
import Users from 'meteor/vulcan:users';
const token = getSetting('intercom.accessToken');
@ -17,6 +24,7 @@ if (!token) {
New User
*/
// eslint-disable-next-line no-inner-declarations
function intercomNewUser(user) {
intercomClient.users.create({
email: user.email,
@ -34,6 +42,7 @@ if (!token) {
Track Event
*/
// eslint-disable-next-line no-inner-declarations
function intercomTrackServer(eventName, eventProperties, currentUser) {
intercomClient.events.create({
event_name: eventName,

View file

@ -1,10 +1,9 @@
import { addTrackFunction } from 'meteor/vulcan:events';
import { ApolloClient } from 'apollo-client';
import { getRenderContext } from 'meteor/vulcan:lib';
import gql from 'graphql-tag';
function trackInternal(eventName, eventProperties) {
const { apolloClient, store } = getRenderContext();
const { apolloClient } = getRenderContext();
const mutation = gql`
mutation AnalyticsEventsNew($document: AnalyticsEventsInput) {
AnalyticsEventsNew(document: $document) {

View file

@ -1,4 +1,4 @@
import { getSetting, addCallback, Utils } from 'meteor/vulcan:core';
import { getSetting, Utils } from 'meteor/vulcan:core';
import {
addPageFunction,
addInitFunction,
@ -41,7 +41,7 @@ Track Event
*/
function segmentTrack(eventName, eventProperties) {
analytics.track(eventName, eventProperties);
window.analytics.track(eventName, eventProperties);
}
addTrackFunction(segmentTrack);
@ -55,8 +55,11 @@ function segmentInit() {
var analytics = (window.analytics = window.analytics || []);
if (!analytics.initialize)
if (analytics.invoked)
// eslint-disable-next-line no-console
window.console &&
// eslint-disable-next-line no-console
console.error &&
// eslint-disable-next-line no-console
console.error('Segment snippet included twice.');
else {
analytics.invoked = !0;

View file

@ -1,6 +1,10 @@
import Analytics from 'analytics-node';
import { getSetting, addCallback, Utils } from 'meteor/vulcan:core';
import { addPageFunction, addInitFunction, addIdentifyFunction, addTrackFunction } from 'meteor/vulcan:events';
import { getSetting } from 'meteor/vulcan:core';
import {
/* addPageFunction, addInitFunction, */
addIdentifyFunction,
addTrackFunction,
} from 'meteor/vulcan:events';
const segmentWriteKey = getSetting('segment.serverKey');
@ -13,6 +17,7 @@ if (segmentWriteKey) {
Identify User
*/
// eslint-disable-next-line no-inner-declarations
function segmentIdentifyServer(currentUser) {
analytics.identify({
userId: currentUser._id,
@ -29,6 +34,7 @@ if (segmentWriteKey) {
Track Event
*/
// eslint-disable-next-line no-inner-declarations
function segmentTrackServer(eventName, eventProperties, currentUser) {
analytics.track({
event: eventName,

View file

@ -157,6 +157,7 @@ class Upload extends PureComponent {
// tell vulcanForm to catch the value
this.context.addToAutofilledValues({[this.props.name]: newValue});
})
// eslint-disable-next-line no-console
.catch(err => console.log('err', err));
}

View file

@ -400,7 +400,8 @@ class Form extends Component {
// get graphQL error (see https://github.com/thebigredgeek/apollo-errors/issues/12)
const graphQLError = error.graphQLErrors[0];
console.log(graphQLError)
// eslint-disable-next-line no-console
console.log(graphQLError);
// add error to state
this.setState(prevState => ({
@ -520,8 +521,10 @@ class Form extends Component {
this.setState(prevState => ({disabled: false}));
console.log("// graphQL Error"); // eslint-disable-line no-console
console.log(error); // eslint-disable-line no-console
// eslint-disable-next-line no-console
console.log("// graphQL Error");
// eslint-disable-next-line no-console
console.log(error);
// run mutation failure callbacks on error, we do not allow the callbacks to change the error
runCallbacks(this.failureFormCallbacks, error);
@ -612,6 +615,7 @@ class Form extends Component {
if (this.props.refetch) this.props.refetch();
})
.catch((error) => {
// eslint-disable-next-line no-console
console.log(error);
});
}

View file

@ -207,7 +207,7 @@ class FormWrapper extends PureComponent {
}`, {
alias: 'withExtraQueries',
props: returnedProps => {
const { ownProps, data } = returnedProps;
const { /* ownProps, */ data } = returnedProps;
const props = {
loading: data.loading,
data,

View file

@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Checkbox } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';

View file

@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import { CheckboxGroup } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';

View file

@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Input } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';

View file

@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Input } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';

View file

@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Input } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';

View file

@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import { RadioGroup } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';

View file

@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Select } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';

View file

@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Textarea } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';

View file

@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Input } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';

View file

@ -2,7 +2,7 @@ import { addStrings } from 'meteor/vulcan:core';
addStrings('en', {
"accounts.error_emailRequired": "Email required",
"accounts.error_email_required": "Email required",
"accounts.error_email_already_exists": "Email already exists",
"accounts.error_invalid_email": "Invalid email",
"accounts.error_minchar": "Your password is too short",

View file

@ -5,4 +5,3 @@ registerSetting('locale', 'en', 'Your app\'s locale (“en”, “fr”, etc.)')
export { default as FormattedMessage } from './message.js';
export { intlShape } from './shape.js';
export { default as IntlProvider } from './provider.js';

View file

@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { getSetting, registerSetting, Strings } from 'meteor/vulcan:lib';
import { getSetting, Strings } from 'meteor/vulcan:lib';
const FormattedMessage = ({ id, values, defaultMessage }) => {
const messages = Strings[getSetting('locale', 'en')] || {};
@ -12,4 +12,4 @@ const FormattedMessage = ({ id, values, defaultMessage }) => {
return <span className="i18n-message">{message}</span>
}
export default FormattedMessage;
export default FormattedMessage;

View file

@ -1,6 +1,5 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { getSetting, registerSetting, Strings } from 'meteor/vulcan:lib';
import { getSetting, Strings } from 'meteor/vulcan:lib';
import { intlShape } from './shape.js';
@ -49,4 +48,4 @@ export default class IntlProvider extends Component{
IntlProvider.childContextTypes = {
intl: intlShape
}
}

View file

@ -85,4 +85,4 @@ export const relativeFormatPropTypes = {
export const pluralFormatPropTypes = {
style: oneOf(['cardinal', 'ordinal']),
};
};

View file

@ -3,7 +3,7 @@ import 'cross-fetch/polyfill';
import { Meteor } from 'meteor/meteor';
import { getSetting, registerSetting } from './settings.js';
import { getFragmentMatcher } from './fragment_matcher.js';
import { Callbacks, runCallbacks } from './callbacks.js';
import { runCallbacks } from './callbacks.js';
registerSetting('developmentServerIp', Meteor.absoluteUrl(), 'Development server IP');

View file

@ -29,6 +29,7 @@ export const registerCallback = function (callback) {
export const addCallback = function (hook, callback) {
if (!callback.name) {
// eslint-disable-next-line no-console
console.log(`// Warning! You are adding an unnamed callback to ${hook}. Please use the function foo () {} syntax.`);
}
@ -94,7 +95,9 @@ export const runCallbacks = function () {
}
} catch (error) {
// eslint-disable-next-line no-console
console.log(`\x1b[31m// error at callback [${callback.name}] in hook [${hook}]\x1b[0m`);
// eslint-disable-next-line no-console
console.log(error);
if (error.break || error.data && error.data.break) {
throw error;

View file

@ -6,7 +6,7 @@ import { runCallbacks } from './callbacks.js';
import { getSetting, registerSetting } from './settings.js';
import { registerFragment, getDefaultFragmentText } from './fragments.js';
import escapeStringRegexp from 'escape-string-regexp';
import { debug } from './debug.js';
// import { debug } from './debug.js';
registerSetting('maxDocumentsPerRequest', 1000, 'Maximum documents per request');

View file

@ -5,8 +5,10 @@ import SimpleSchema from 'simpl-schema';
* @namespace Vulcan
*/
// eslint-disable-next-line no-undef
Vulcan = {};
// eslint-disable-next-line no-undef
Vulcan.VERSION = '1.8.5';
// ------------------------------------- Schemas -------------------------------- //
@ -36,4 +38,5 @@ SimpleSchema.extendOptions([
'description',
]);
// eslint-disable-next-line no-undef
export default Vulcan;

View file

@ -2,17 +2,20 @@ import { getSetting } from './settings.js';
export const debug = function () {
if (getSetting('debug', false)) {
// eslint-disable-next-line no-console
console.log.apply(null, arguments);
}
}
export const debugGroup = function () {
if (getSetting('debug', false)) {
// eslint-disable-next-line no-console
console.groupCollapsed.apply(null, arguments);
}
}
export const debugGroupEnd = function () {
if (getSetting('debug', false)) {
// eslint-disable-next-line no-console
console.groupEnd.apply(null, arguments);
}
}

View file

@ -234,6 +234,7 @@ input ${collectionName}Unset {
Vulcan.getGraphQLSchema = () => {
const schema = GraphQLSchema.finalSchema[0];
// eslint-disable-next-line no-console
console.log(schema);
return schema;
}

View file

@ -109,26 +109,4 @@ export const getSetting = (settingName, settingDefault) => {
}
// Settings collection is deprecated
// getSetting = function (setting, defaultValue) {
// const collection = Telescope.settings.collection;
// if (typeof getSettingFromJSON(setting) !== "undefined") { // if on the server, look in Meteor.settings
// return getSettingFromJSON(setting);
// } else if (collection && collection.findOne() && typeof collection.findOne()[setting] !== "undefined") { // look in collection
// return Telescope.settings.collection.findOne()[setting];
// } else if (typeof defaultValue !== 'undefined') { // fallback to default
// return defaultValue;
// } else { // or return undefined
// return undefined;
// }
// };
registerSetting('debug', false, 'Enable debug mode (more verbose logging)');

View file

@ -9,7 +9,7 @@ import urlObject from 'url';
import moment from 'moment';
import sanitizeHtml from 'sanitize-html';
import getSlug from 'speakingurl';
import { getSetting, registerSetting } from './settings.js';
import { getSetting } from './settings.js';
import { Routes } from './routes.js';
import { isAbsolute } from 'path';
import { getCollection } from './collections.js';
@ -131,7 +131,7 @@ Utils.getDateRange = function(pageNumber) {
* @summary Returns the user defined site URL or Meteor.absoluteUrl. Add trailing '/' if missing
*/
Utils.getSiteUrl = function () {
const url = getSetting('siteUrl', Meteor.absoluteUrl());
let url = getSetting('siteUrl', Meteor.absoluteUrl());
if (url.slice(-1) !== '/') {
url += '/';
}

View file

@ -60,7 +60,8 @@ export const validateDocument = (document, collection, context) => {
try {
collection.simpleSchema().validate(document);
} catch (error) {
console.log(error)
// eslint-disable-next-line no-console
console.log(error);
validationErrors.push({
id: 'app.schema_validation_error',
data: {message: error.message}
@ -141,7 +142,8 @@ export const validateModifier = (modifier, document, collection, context) => {
try {
collection.simpleSchema().validate({$set: set, $unset: unset}, { modifier: true });
} catch (error) {
console.log(error)
// eslint-disable-next-line no-console
console.log(error);
validationErrors.push({
id: 'app.schema_validation_error',
data: {message: error.message}

View file

@ -1,8 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { WebApp } from 'meteor/webapp';
import { Utils } from '../modules/index.js';
// clever webAppConnectHandlersUse
export const webAppConnectHandlersUse = (name, route, fn, options) => {
// init

View file

@ -137,8 +137,10 @@ export const editMutation = async ({ collection, documentId, set = {}, unset = {
modifier = runCallbacks(`${collectionName}.edit.validate`, modifier, document, currentUser, validationErrors);
if (validationErrors.length) {
console.log('// validationErrors')
console.log(validationErrors)
// eslint-disable-next-line no-console
console.log('// validationErrors');
// eslint-disable-next-line no-console
console.log(validationErrors);
const EditDocumentValidationError = createError('app.validation_error', {message: 'app.edit_document_validation_error'});
throw new EditDocumentValidationError({data: {break: true, errors: validationErrors}});
}

View file

@ -24,6 +24,7 @@ export const runQuery = async (query, variables = {}, context = { currentUser: {
const result = await graphql(executableSchema, query, {}, context, variables);
if (result.errors) {
// eslint-disable-next-line no-console
console.log('runQuery error: '+result.errors[0].message);
throw new Error(result.errors[0].message);
}

View file

@ -1,6 +1,6 @@
import { addGraphQLSchema, addGraphQLResolvers, addGraphQLQuery } from '../modules/graphql.js';
import { Utils } from '../modules/utils';
import { getSetting, registerSetting } from '../modules/settings.js';
import { getSetting } from '../modules/settings.js';
const siteSchema = `type Site {
title: String

View file

@ -7,7 +7,7 @@ This is a sample template for future integrations.
import { getSetting, regiserSetting } from 'meteor/vulcan:core';
import Newsletters from '../../modules/collection.js';
regiserSetting('providerName')
regiserSetting('providerName');
/*
@ -19,7 +19,8 @@ const settings = getSetting('providerName');
if (settings) {
const {server, apiKey, listId, somethingElse } = settings;
const {server, apiKey, /* listId, somethingElse */ } = settings;
// eslint-disable-next-line no-undef
const MyProviderAPI = new ProviderAPI(server, apiKey);
const subscribeSync = options => {
@ -27,7 +28,8 @@ if (settings) {
const wrapped = Meteor.wrapAsync( MyProviderAPI.subscribe, MyProviderAPI );
return wrapped( options );
} catch ( error ) {
console.log(error)
// eslint-disable-next-line no-console
console.log(error);
}
};
@ -36,7 +38,8 @@ if (settings) {
const wrapped = Meteor.wrapAsync( MyProviderAPI.unsubscribe, MyProviderAPI );
return wrapped( options );
} catch ( error ) {
console.log(error)
// eslint-disable-next-line no-console
console.log(error);
}
};
@ -45,7 +48,8 @@ if (settings) {
const wrapped = Meteor.wrapAsync( MyProviderAPI.send, MyProviderAPI );
return wrapped( options );
} catch ( error ) {
console.log(error)
// eslint-disable-next-line no-console
console.log(error);
}
};

View file

@ -22,8 +22,10 @@ if (settings) {
const wrapped = Meteor.wrapAsync( SendyAPI.subscribe, SendyAPI );
return wrapped( options );
} catch ( error ) {
console.log('// Sendy API error')
console.log(error)
// eslint-disable-next-line no-console
console.log('// Sendy API error');
// eslint-disable-next-line no-console
console.log(error);
if (error.message === 'Already subscribed.') {
return {result: 'already-subscribed'}
}
@ -35,8 +37,10 @@ if (settings) {
const wrapped = Meteor.wrapAsync( SendyAPI.unsubscribe, SendyAPI );
return wrapped( options );
} catch ( error ) {
console.log('// Sendy API error')
console.log(error)
// eslint-disable-next-line no-console
console.log('// Sendy API error');
// eslint-disable-next-line no-console
console.log(error);
}
};
@ -45,8 +49,10 @@ if (settings) {
const wrapped = Meteor.wrapAsync( SendyAPI.createCampaign, SendyAPI );
return wrapped( options );
} catch ( error ) {
console.log('// Sendy API error')
console.log(error)
// eslint-disable-next-line no-console
console.log('// Sendy API error');
// eslint-disable-next-line no-console
console.log(error);
}
};

View file

@ -42,8 +42,10 @@ Newsletters.subscribeUser = (user, confirm = false) => {
throw 'User must have an email address';
}
console.log(`// Adding ${email} to ${provider} list…`); // eslint-disable-line
// eslint-disable-next-line no-console
console.log(`// Adding ${email} to ${provider} list…`);
const result = Newsletters[provider].subscribe(email, confirm);
// eslint-disable-next-line no-console
if (result) {console.log ('-> added')}
Users.setSetting(user, 'newsletter_subscribeToNewsletter', true);
}
@ -53,8 +55,10 @@ Newsletters.subscribeUser = (user, confirm = false) => {
* @param {String} email
*/
Newsletters.subscribeEmail = (email, confirm = false) => {
console.log(`// Adding ${email} to ${provider} list…`); // eslint-disable-line
// eslint-disable-next-line no-console
console.log(`// Adding ${email} to ${provider} list…`);
const result = Newsletters[provider].subscribe(email, confirm);
// eslint-disable-next-line no-console
if (result) {console.log ('-> added')}
}
@ -68,8 +72,9 @@ Newsletters.unsubscribeUser = (user) => {
if (!email) {
throw 'User must have an email address';
}
console.log('// Removing "'+email+'" from list…'); // eslint-disable-line
// eslint-disable-next-line no-console
console.log('// Removing "'+email+'" from list…');
Newsletters[provider].unsubscribe(email);
Users.setSetting(user, 'newsletter_subscribeToNewsletter', false);
}
@ -79,7 +84,8 @@ Newsletters.unsubscribeUser = (user) => {
* @param {String} email
*/
Newsletters.unsubscribeEmail = (email) => {
console.log('// Removing "'+email+'" from list…'); // eslint-disable-line
// eslint-disable-next-line no-console
console.log('// Removing "'+email+'" from list…');
Newsletters[provider].unsubscribe(email);
}
@ -238,8 +244,10 @@ Newsletters.send = async (isTest = false) => {
if(newsletterEmail.isValid(data)){
// eslint-disable-next-line no-console
console.log('// Sending newsletter…');
console.log('// Subject: '+subject)
// eslint-disable-next-line no-console
console.log('// Subject: '+subject);
const newsletter = Newsletters[provider].send({ subject, text, html, isTest });
@ -270,7 +278,8 @@ Newsletters.send = async (isTest = false) => {
}
} else {
// eslint-disable-next-line no-console
console.log('No newsletter to schedule today…');
}

View file

@ -1,6 +1,6 @@
import React from 'react'
import StripeCheckout from 'react-stripe-checkout';
import { Components, registerComponent, getSetting, registerSetting, withCurrentUser, withMessages } from 'meteor/vulcan:core';
import { Components, registerComponent, getSetting, withCurrentUser, withMessages } from 'meteor/vulcan:core';
import Users from 'meteor/vulcan:users';
import { intlShape } from 'meteor/vulcan:i18n';
import classNames from 'classnames';
@ -48,8 +48,9 @@ class Checkout extends React.Component {
}
}).catch(error => {
console.log(error)
// eslint-disable-next-line no-console
console.log(error);
flash(this.context.intl.formatMessage({id: 'payments.error'}), 'error');
});

View file

@ -1,8 +1,6 @@
import { getSetting, registerSetting, newMutation, editMutation, Collections, registerCallback, runCallbacks, runCallbacksAsync } from 'meteor/vulcan:core';
import express from 'express';
import Stripe from 'stripe';
import { Picker } from 'meteor/meteorhacks:picker';
import bodyParser from 'body-parser';
import Charges from '../../modules/charges/collection.js';
import Users from 'meteor/vulcan:users';
import { Products } from '../../modules/products.js';
@ -122,8 +120,8 @@ Create one-time charge.
*/
export const createCharge = async ({user, customer, product, collection, document, metadata, args}) => {
const {token, userId, productKey, associatedId, properties, coupon } = args;
const { /* token, userId, productKey, associatedId, properties, */ coupon } = args;
let amount = product.amount;
@ -229,6 +227,7 @@ export const subscribeUser = async ({user, customer, product, collection, docume
// create an invoice item and attach it to the customer first
// see https://stripe.com/docs/subscriptions/invoices#adding-invoice-items
if (product.initialAmount) {
// eslint-disable-next-line no-unused-vars
const initialInvoiceItem = await stripe.invoiceItems.create({
customer: customer.id,
amount: product.initialAmount,
@ -237,6 +236,7 @@ export const subscribeUser = async ({user, customer, product, collection, docume
});
}
// eslint-disable-next-line no-unused-vars
const subscription = await stripe.subscriptions.create({
customer: customer.id,
items: [
@ -246,8 +246,10 @@ export const subscribeUser = async ({user, customer, product, collection, docume
});
} catch (error) {
console.log('// Stripe subscribeUser error')
console.log(error)
// eslint-disable-next-line no-console
console.log('// Stripe subscribeUser error');
// eslint-disable-next-line no-console
console.log(error);
}
}
@ -283,7 +285,8 @@ app.use(addRawBody);
app.post('/stripe', async function(req, res) {
console.log('////////////// stripe webhook')
// eslint-disable-next-line no-console
console.log('////////////// stripe webhook');
const sig = req.headers['stripe-signature'];
@ -291,30 +294,38 @@ app.post('/stripe', async function(req, res) {
const event = stripe.webhooks.constructEvent(req.rawBody, sig, stripeSettings.endpointSecret);
console.log('event ///////////////////')
console.log(event)
// eslint-disable-next-line no-console
console.log('event ///////////////////');
// eslint-disable-next-line no-console
console.log(event);
switch (event.type) {
case 'charge.succeeded':
console.log('////// charge succeeded')
// eslint-disable-next-line no-console
console.log('////// charge succeeded');
const charge = event.data.object;
console.log(charge)
// eslint-disable-next-line no-console
console.log(charge);
try {
// look up corresponding invoice
const invoice = await stripe.invoices.retrieve(charge.invoice);
console.log('////// invoice')
console.log(invoice)
// eslint-disable-next-line no-console
console.log('////// invoice');
// eslint-disable-next-line no-console
console.log(invoice);
// look up corresponding subscription
const subscription = await stripe.subscriptions.retrieve(invoice.subscription);
console.log('////// subscription')
console.log(subscription)
// eslint-disable-next-line no-console
console.log('////// subscription');
// eslint-disable-next-line no-console
console.log(subscription);
const { userId, productKey, associatedCollection, associatedId } = subscription.metadata;
@ -334,8 +345,10 @@ app.post('/stripe', async function(req, res) {
}
} catch (error) {
console.log('// Stripe webhook error')
console.log(error)
// eslint-disable-next-line no-console
console.log('// Stripe webhook error');
// eslint-disable-next-line no-console
console.log(error);
}
break;
@ -343,8 +356,10 @@ app.post('/stripe', async function(req, res) {
}
} catch (error) {
console.log('///// Stripe webhook error')
console.log(error)
// eslint-disable-next-line no-console
console.log('///// Stripe webhook error');
// eslint-disable-next-line no-console
console.log(error);
}
res.sendStatus(200);
@ -434,7 +449,7 @@ webAppConnectHandlersUse(Meteor.bindEnvironment(app), {name: 'stripe_endpoint',
Meteor.startup(() => {
Collections.forEach(c => {
collectionName = c._name.toLowerCase();
const collectionName = c._name.toLowerCase();
registerCallback({
name: `${collectionName}.charge.sync`,

View file

@ -33,7 +33,8 @@ Users.avatar = {
* @return {String} md5 hash of the input
*/
hash: function (string) {
var self = this
var self = this;
// eslint-disable-next-line babel/new-cap
return CryptoJS.MD5(self.cleanString(string)).toString()
},

View file

@ -1,5 +1,4 @@
import { addGraphQLResolvers } from 'meteor/vulcan:lib';
import Users from './collection.js';
const specificResolvers = {
Query: {

View file

@ -1 +1,2 @@
Accounts.urls.resetPassword = (token) => Meteor.absoluteUrl(`reset-password/${token}`);
Accounts.urls.enrollAccount = (token) => Meteor.absoluteUrl(`enroll-account/${token}`);

View file

@ -1,4 +1,4 @@
import { debug, runCallbacksAsync, runCallbacks, addCallback } from 'meteor/vulcan:core';
import { debug, /* runCallbacksAsync, runCallbacks, addCallback */ } from 'meteor/vulcan:core';
import { createError } from 'apollo-errors';
import Votes from './votes/collection.js';
import Users from 'meteor/vulcan:users';

View file

@ -1,4 +1,4 @@
import { createCollection, getDefaultResolvers, getDefaultMutations } from 'meteor/vulcan:core';
import { createCollection, /* getDefaultResolvers, getDefaultMutations */ } from 'meteor/vulcan:core';
import schema from './schema.js';
const Votes = createCollection({

View file

@ -1,7 +1,7 @@
import { addCallback, Utils } from 'meteor/vulcan:core';
import Users from 'meteor/vulcan:users';
import { getVotePower } from '../modules/vote.js';
import { updateScore } from './scoring.js';
// import { addCallback, Utils } from 'meteor/vulcan:core';
// import Users from 'meteor/vulcan:users';
// import { getVotePower } from '../modules/vote.js';
// import { updateScore } from './scoring.js';
// ----------------------------- vote.async ------------------------------- //

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