mirror of
https://github.com/vale981/Vulcan
synced 2025-03-04 17:21:37 -05:00
fix some lint issues, remove some dead code, remove double imports from the same package & import from core instead of lib except for packages depending explicitly on lib (users, emails, ..)
This commit is contained in:
parent
eb2644ad8a
commit
e533dd47e7
91 changed files with 92 additions and 647 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Components, getRawComponent, replaceComponent } from 'meteor/nova:lib';
|
||||
import { Components, getRawComponent, replaceComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage, FormattedRelative } from 'react-intl';
|
||||
import { Link } from 'react-router';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { extendFragment } from 'meteor/nova:lib';
|
||||
import { extendFragment } from 'meteor/nova:core';
|
||||
|
||||
extendFragment('PostsList', `
|
||||
color # new custom property!
|
||||
|
|
|
@ -7,8 +7,7 @@ Wrapped with the "withCurrentUser" container.
|
|||
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { Button } from 'react-bootstrap';
|
||||
import { ModalTrigger } from 'meteor/nova:core';
|
||||
import { Components, registerComponent, withCurrentUser } from 'meteor/nova:core';
|
||||
import { Components, registerComponent, withCurrentUser, ModalTrigger } from 'meteor/nova:core';
|
||||
import Movies from '../collection.js';
|
||||
|
||||
class MoviesItem extends Component {
|
||||
|
|
|
@ -5,7 +5,6 @@ A SimpleSchema-compatible JSON schema
|
|||
*/
|
||||
|
||||
import Users from 'meteor/nova:users';
|
||||
import { GraphQLSchema } from 'meteor/nova:core';
|
||||
|
||||
// define schema
|
||||
const schema = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { GraphQLSchema } from 'meteor/nova:lib';
|
||||
import { GraphQLSchema } from 'meteor/nova:core';
|
||||
|
||||
import { makeExecutableSchema } from 'graphql-tools';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { GraphQLSchema } from 'meteor/nova:lib';
|
||||
import { GraphQLSchema } from 'meteor/nova:core';
|
||||
|
||||
const generateTypeDefs = () => [`
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import { _ } from 'meteor/underscore';
|
|||
|
||||
import Users from 'meteor/nova:users';
|
||||
|
||||
import { GraphQLSchema } from 'meteor/nova:lib';
|
||||
import { GraphQLSchema } from 'meteor/nova:core';
|
||||
|
||||
import OpticsAgent from 'optics-agent'
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
import { intlShape } from 'react-intl';
|
||||
import { Components, registerComponent, getFragment } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, getFragment, withMessages } from 'meteor/nova:core';
|
||||
import Categories from "meteor/nova:categories";
|
||||
import { withMessages } from 'meteor/nova:core';
|
||||
|
||||
const CategoriesEditForm = (props, context) => {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ModalTrigger, Components, registerComponent, ShowIf, withList, Utils } from "meteor/nova:core";
|
||||
import { ModalTrigger, Components, registerComponent, withList, Utils } from "meteor/nova:core";
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { Button, DropdownButton, MenuItem, Modal } from 'react-bootstrap';
|
||||
import { Button, DropdownButton, MenuItem } from 'react-bootstrap';
|
||||
import { withRouter } from 'react-router'
|
||||
import { LinkContainer } from 'react-router-bootstrap';
|
||||
import Categories from 'meteor/nova:categories';
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
import { intlShape } from 'react-intl';
|
||||
import { Components, registerComponent, getFragment } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, getFragment, withMessages } from 'meteor/nova:core';
|
||||
import Categories from "meteor/nova:categories";
|
||||
import { withMessages } from 'meteor/nova:core';
|
||||
|
||||
const CategoriesNewForm = (props, context) => {
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
|
||||
class CategoriesNode extends Component {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { Components, registerComponent, getFragment } from 'meteor/nova:core';
|
||||
import { Components, registerComponent, getFragment, withMessages } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import Comments from "meteor/nova:comments";
|
||||
import { withMessages } from 'meteor/nova:core';
|
||||
|
||||
const CommentsEditForm = (props, context) => {
|
||||
return (
|
||||
|
@ -26,4 +25,4 @@ CommentsEditForm.propTypes = {
|
|||
cancelCallback: React.PropTypes.func
|
||||
};
|
||||
|
||||
registerComponent('CommentsEditForm', CommentsEditForm, withMessages);
|
||||
registerComponent('CommentsEditForm', CommentsEditForm, withMessages);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, withCurrentUser, withMessages } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { intlShape, FormattedMessage, FormattedRelative } from 'react-intl';
|
||||
import { ShowIf, withCurrentUser, withMessages } from 'meteor/nova:core';
|
||||
import Comments from 'meteor/nova:comments';
|
||||
|
||||
class CommentsItem extends Component{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
|
||||
const CommentsLoadMore = ({loadMore, count, totalCount}) => {
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
import Comments from "meteor/nova:comments";
|
||||
|
||||
class CommentsNew extends Component {
|
||||
|
||||
render() {
|
||||
|
||||
let prefilledProps = {postId: this.props.postId};
|
||||
|
||||
if (this.props.parentComment) {
|
||||
prefilledProps = Object.assign(prefilledProps, {
|
||||
parentCommentId: this.props.parentComment._id,
|
||||
// if parent comment has a topLevelCommentId use it; if it doesn't then it *is* the top level comment
|
||||
topLevelCommentId: this.props.parentComment.topLevelCommentId || this.props.parentComment._id
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="comments-new-form">
|
||||
<Components.SmartForm
|
||||
collection={Comments}
|
||||
methodName="comments.new"
|
||||
prefilledProps={prefilledProps}
|
||||
successCallback={this.props.successCallback}
|
||||
layout="elementOnly"
|
||||
cancelCallback={this.props.type === "reply" ? this.props.cancelCallback : null}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CommentsNew.propTypes = {
|
||||
postId: React.PropTypes.string.isRequired,
|
||||
type: React.PropTypes.string, // "comment" or "reply"
|
||||
parentComment: React.PropTypes.object, // if reply, the comment being replied to
|
||||
parentCommentId: React.PropTypes.string, // if reply
|
||||
topLevelCommentId: React.PropTypes.string, // if reply
|
||||
successCallback: React.PropTypes.func, // a callback to execute when the submission has been successful
|
||||
cancelCallback: React.PropTypes.func
|
||||
}
|
||||
|
||||
CommentsNew.contextTypes = {
|
||||
currentUser: React.PropTypes.object
|
||||
}
|
||||
|
||||
module.exports = CommentsNew;
|
|
@ -1,7 +1,6 @@
|
|||
import { Components, registerComponent, getFragment } from 'meteor/nova:core';
|
||||
import { Components, registerComponent, getFragment, withMessages } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import Comments from "meteor/nova:comments";
|
||||
import { ShowIf, withMessages } from 'meteor/nova:core';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
const CommentsNewForm = (props, context) => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
|
||||
class CommentsNode extends Component {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { Alert } from 'react-bootstrap';
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { withMessages } from 'meteor/nova:core';
|
||||
import { Components, registerComponent, withMessages } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
|
||||
const FlashMessages = ({messages, clear, markAsSeen}) => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
|
||||
class Layout extends Component {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import { IndexLink } from 'react-router';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, withCurrentUser, withMutation, withMessages } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage, intlShape } from 'react-intl';
|
||||
import Formsy from 'formsy-react';
|
||||
|
@ -6,7 +6,6 @@ import { Input } from 'formsy-react-components';
|
|||
import { Button } from 'react-bootstrap';
|
||||
import Cookie from 'react-cookie';
|
||||
import Users from 'meteor/nova:users';
|
||||
import { withCurrentUser, withMutation, withMessages } from 'meteor/nova:core';
|
||||
|
||||
class Newsletter extends Component {
|
||||
|
||||
|
@ -27,13 +26,13 @@ class Newsletter extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
subscribeEmail(data) {
|
||||
this.props.addEmailNewsletter({email: data.email}).then(result => {
|
||||
async subscribeEmail(data) {
|
||||
try {
|
||||
const result = await this.props.addEmailNewsletter({email: data.email});
|
||||
this.successCallbackSubscription(result);
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
} catch(error) {
|
||||
this.props.flash(error.message, "error");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
successCallbackSubscription(result) {
|
||||
|
@ -100,8 +99,6 @@ function showBanner (user) {
|
|||
return (
|
||||
// showBanner cookie either doesn't exist or is not set to "no"
|
||||
Cookie.load('showBanner') !== "no"
|
||||
// and showBanner user setting either doesn't exist or is set to true
|
||||
// && Users.getSetting(user, 'newsletter.showBanner', true)
|
||||
// and user is not subscribed to the newsletter already (setting either DNE or is not set to false)
|
||||
&& !Users.getSetting(user, 'newsletter_subscribeToNewsletter', false)
|
||||
);
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, withMutation, withCurrentUser, withMessages } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { Button } from 'react-bootstrap';
|
||||
import { withMutation, withCurrentUser, withMessages } from 'meteor/nova:core';
|
||||
|
||||
class NewsletterButton extends Component {
|
||||
constructor(props) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { intlShape } from 'react-intl';
|
||||
import Formsy from 'formsy-react';
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, withMessages } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { withMessages } from 'meteor/nova:core';
|
||||
import { withVote, hasUpvoted, hasDownvoted } from 'meteor/nova:voting';
|
||||
|
||||
class Vote extends Component {
|
||||
|
|
|
@ -56,10 +56,6 @@ import './categories/Category.jsx';
|
|||
import './categories/CategoriesEditForm.jsx';
|
||||
import './categories/CategoriesNewForm.jsx';
|
||||
|
||||
// permissions
|
||||
|
||||
import './permissions/CanDo.jsx';
|
||||
|
||||
// users
|
||||
|
||||
import './users/UsersSingle.jsx';
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
// Deprecated way to handle permission in components, check CanDo component
|
||||
|
||||
// import Telescope from 'meteor/nova:lib';
|
||||
// import React, { PropTypes, Component } from 'react';
|
||||
// import { FormattedMessage } from 'react-intl';
|
||||
// import Users from 'meteor/nova:users';
|
||||
|
||||
// const CanCreatePost = (props, context) => {
|
||||
|
||||
// const currentUser = context.currentUser;
|
||||
|
||||
// const children = props.children;
|
||||
// const UsersAccountForm = Telescope.components.UsersAccountForm;
|
||||
|
||||
// if (!currentUser){
|
||||
// return (
|
||||
// <div className="log-in-message">
|
||||
// <h3><FormattedMessage id="users.please_log_in"/></h3>
|
||||
// <UsersAccountForm/>
|
||||
// </div>
|
||||
// )
|
||||
// } else if (Users.canDo(currentUser, "posts.new")) {
|
||||
// return children;
|
||||
// } else {
|
||||
// return <p><FormattedMessage id="users.cannot_post"/></p>;
|
||||
// }
|
||||
// };
|
||||
|
||||
// CanCreatePost.contextTypes = {
|
||||
// currentUser: React.PropTypes.object
|
||||
// };
|
||||
|
||||
// CanCreatePost.displayName = "CanCreatePost";
|
||||
|
||||
// module.exports = CanCreatePost;
|
|
@ -1,59 +0,0 @@
|
|||
// import Telescope from 'meteor/nova:lib';
|
||||
// import React, { PropTypes } from 'react';
|
||||
// import { FormattedMessage } from 'react-intl';
|
||||
// import Users from 'meteor/nova:users';
|
||||
// import { withCurrentUser } from 'meteor/nova:core';
|
||||
|
||||
// const CanDo = (props, context) => {
|
||||
|
||||
// // no user login, display the login form
|
||||
// if (!props.currentUser && props.displayNoPermissionMessage) {
|
||||
// return (
|
||||
// <div className="log-in-message">
|
||||
// <h3><FormattedMessage id="users.please_log_in"/></h3>
|
||||
// <Telescope.components.UsersAccountForm />
|
||||
// </div>
|
||||
// );
|
||||
// }
|
||||
|
||||
// // default permission, is the user allowed to perform this action?
|
||||
// let permission = Users.canDo(props.currentUser, props.action);
|
||||
|
||||
// // the permission is about viewing a document, check if the user is allowed
|
||||
// if (props.document && props.action.indexOf('view') > -1) {
|
||||
// // use the permission shortcut canView on the current user and requested document
|
||||
// permission = Users.canView(props.currentUser, props.document);
|
||||
// }
|
||||
|
||||
// // the permission is about editing a document, check if the user is allowed
|
||||
// if (props.document && props.action.indexOf('edit') > -1) {
|
||||
// // use the permission shortcut canEdit on the current user and requested document
|
||||
// permission = Users.canEdit(props.currentUser, props.document);
|
||||
// }
|
||||
|
||||
|
||||
// // the user can perform the intented action in the component: display the component,
|
||||
// // else: display a not allowed message
|
||||
// if (permission) {
|
||||
// return props.children;
|
||||
// } else {
|
||||
// return props.displayNoPermissionMessage ? <p><FormattedMessage id={props.noPermissionMessage}/></p> : null;
|
||||
// }
|
||||
// };
|
||||
|
||||
// CanDo.propTypes = {
|
||||
// action: React.PropTypes.string.isRequired,
|
||||
// currentUser: React.PropTypes.object,
|
||||
// document: React.PropTypes.object,
|
||||
// noPermissionMessage: React.PropTypes.string,
|
||||
// displayNoPermissionMessage: React.PropTypes.bool,
|
||||
// };
|
||||
|
||||
// CanDo.defaultProps = {
|
||||
// noPermissionMessage: 'app.noPermission',
|
||||
// displayNoPermissionMessage: false,
|
||||
// };
|
||||
|
||||
// CanDo.displayName = "CanDo";
|
||||
|
||||
// Telescope.registerComponent('CanDo', CanDo, withCurrentUser);
|
|
@ -1,23 +0,0 @@
|
|||
// Deprecated way to handle permission in components, check CanDo component
|
||||
|
||||
// import React, { PropTypes, Component } from 'react';
|
||||
// import Users from 'meteor/nova:users';
|
||||
|
||||
// const CanEditPost = ({user, post, children}) => {
|
||||
// if (Users.canEdit(user, post)) {
|
||||
// return children;
|
||||
// } else if (!user){
|
||||
// return <p>Please log in.</p>;
|
||||
// } else {
|
||||
// return <p>Sorry, you do not have permissions to edit this post at this time</p>;
|
||||
// }
|
||||
// };
|
||||
|
||||
// CanEditPost.propTypes = {
|
||||
// user: React.PropTypes.object,
|
||||
// post: React.PropTypes.object
|
||||
// }
|
||||
|
||||
// CanEditPost.displayName = "CanEditPost";
|
||||
|
||||
// module.exports = CanEditPost;
|
|
@ -1,23 +0,0 @@
|
|||
// Deprecated way to handle permission in components, check CanDo component
|
||||
|
||||
// import React, { PropTypes, Component } from 'react';
|
||||
// import Users from 'meteor/nova:users';
|
||||
|
||||
// const CanEditUser = ({user, userToEdit, children}) => {
|
||||
// if (!user){
|
||||
// return <p>Please log in.</p>;
|
||||
// } else if (Users.canEdit(user, userToEdit)) {
|
||||
// return children;
|
||||
// } else {
|
||||
// return <p>Sorry, you do not have permissions to edit this user at this time</p>;
|
||||
// }
|
||||
// };
|
||||
|
||||
// CanEditUser.propTypes = {
|
||||
// user: React.PropTypes.object,
|
||||
// userToEdit: React.PropTypes.object
|
||||
// }
|
||||
|
||||
// CanEditUser.displayName = "CanEditUser";
|
||||
|
||||
// module.exports = CanEditUser;
|
|
@ -1,22 +0,0 @@
|
|||
// Deprecated way to handle permission in components, check CanDo component
|
||||
|
||||
// import React, { PropTypes, Component } from 'react';
|
||||
// import Users from 'meteor/nova:users';
|
||||
|
||||
// const CanView = ({user, children}) => {
|
||||
// if (Users.canDo(user, "posts.view.approved.all")) {
|
||||
// return children;
|
||||
// } else if (!user){
|
||||
// return <p>Please log in.</p>;
|
||||
// } else {
|
||||
// return <p>Sorry, you do not have permissions to post at this time</p>;
|
||||
// }
|
||||
// };
|
||||
|
||||
// CanView.propTypes = {
|
||||
// user: React.PropTypes.object
|
||||
// }
|
||||
|
||||
// CanView.displayName = "CanView";
|
||||
|
||||
// module.exports = CanView;
|
|
@ -1,23 +0,0 @@
|
|||
// Deprecated way to handle permission in components, check CanDo component
|
||||
|
||||
// import React, { PropTypes, Component } from 'react';
|
||||
// import Users from 'meteor/nova:users';
|
||||
|
||||
// const CanViewPost = ({user, post, children}) => {
|
||||
// if (Users.canView(this.props.user, this.props.document)) {
|
||||
// return this.props.children;
|
||||
// } else if (!this.props.user){
|
||||
// return <p>Please log in.</p>;
|
||||
// } else {
|
||||
// return <p>Sorry, you do not have permissions to post at this time</p>;
|
||||
// }
|
||||
// };
|
||||
|
||||
// CanViewPost.propTypes = {
|
||||
// user: React.PropTypes.object,
|
||||
// post: React.PropTypes.object
|
||||
// }
|
||||
|
||||
// CanViewPost.displayName = "CanViewPost";
|
||||
|
||||
// module.exports = CanViewPost;
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import Posts from "meteor/nova:posts";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
|
||||
class PostsDay extends Component {
|
||||
|
||||
render() {
|
||||
|
||||
const {date, networkStatus, posts} = this.props;
|
||||
const {date, posts} = this.props;
|
||||
const noPosts = posts.length === 0;
|
||||
|
||||
return (
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { Components, registerComponent, getFragment } from 'meteor/nova:core';
|
||||
import { Components, registerComponent, getFragment, withMessages } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { intlShape } from 'react-intl';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import { withRouter } from 'react-router'
|
||||
import { ShowIf, withMessages } from 'meteor/nova:core';
|
||||
|
||||
class PostsEditForm extends Component {
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
|
||||
const PostsHome = (props, context) => {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, ModalTrigger } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage, FormattedRelative } from 'react-intl';
|
||||
import { ModalTrigger } from "meteor/nova:core";
|
||||
import { Link } from 'react-router';
|
||||
import Posts from "meteor/nova:posts";
|
||||
// import { withCurrentUser } from 'meteor/nova:core';
|
||||
|
||||
class PostsItem extends Component {
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import { Components, getRawComponent, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, getRawComponent, registerComponent, withList, withCurrentUser } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import { withList } from 'meteor/nova:core';
|
||||
import Posts from 'meteor/nova:posts';
|
||||
import { withCurrentUser } from 'meteor/nova:core';
|
||||
|
||||
const PostsList = (props) => {
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import Categories from "meteor/nova:categories";
|
||||
|
||||
const PostsListHeader = () => {
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
|
||||
const PostsLoading = props => {
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, withCurrentUser } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage, intlShape } from 'react-intl';
|
||||
import { Button } from 'react-bootstrap';
|
||||
import { ModalTrigger } from "meteor/nova:core";
|
||||
import Posts from "meteor/nova:posts";
|
||||
import { withCurrentUser } from 'meteor/nova:core';
|
||||
|
||||
const PostsNewButton = (props, context) => {
|
||||
|
||||
|
@ -28,4 +25,4 @@ PostsNewButton.contextTypes = {
|
|||
intl: intlShape
|
||||
};
|
||||
|
||||
registerComponent('PostsNewButton', PostsNewButton, withCurrentUser);
|
||||
registerComponent('PostsNewButton', PostsNewButton, withCurrentUser);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Components, registerComponent, getRawComponent, getFragment } from 'meteor/nova:core';
|
||||
import { ShowIf, withMessages } from 'meteor/nova:core';
|
||||
import { Components, registerComponent, getRawComponent, getFragment, withMessages } from 'meteor/nova:core';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { intlShape } from 'react-intl';
|
||||
|
@ -39,4 +38,4 @@ PostsNewForm.contextTypes = {
|
|||
|
||||
PostsNewForm.displayName = "PostsNewForm";
|
||||
|
||||
registerComponent('PostsNewForm', PostsNewForm, withRouter, withMessages);
|
||||
registerComponent('PostsNewForm', PostsNewForm, withRouter, withMessages);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import Posts from "meteor/nova:posts";
|
||||
|
||||
const PostsSingle = (props, context) => {
|
||||
return <Components.PostsPage documentId={props.params._id} />
|
||||
|
@ -8,4 +7,4 @@ const PostsSingle = (props, context) => {
|
|||
|
||||
PostsSingle.displayName = "PostsSingle";
|
||||
|
||||
registerComponent('PostsSingle', PostsSingle);
|
||||
registerComponent('PostsSingle', PostsSingle);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
|
||||
const PostsStats = ({post}) => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import Posts from "meteor/nova:posts";
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent, withCurrentUser } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage, intlShape } from 'react-intl';
|
||||
import { DropdownButton, MenuItem } from 'react-bootstrap';
|
||||
import { LinkContainer } from 'react-router-bootstrap';
|
||||
import { withRouter } from 'react-router'
|
||||
import Users from 'meteor/nova:users';
|
||||
import { withCurrentUser } from 'meteor/nova:core';
|
||||
|
||||
const PostsViews = (props, context) => {
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, withCurrentUser } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import { withCurrentUser } from 'meteor/nova:core';
|
||||
|
||||
const UsersAccount = (props, context) => {
|
||||
// note: terms is as the same as a document-shape the SmartForm edit-mode expects to receive
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { Button, FormControl } from 'react-bootstrap';
|
||||
import { Accounts } from 'meteor/std:accounts-ui';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { Dropdown } from 'react-bootstrap';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import Users from 'meteor/nova:users';
|
||||
import { Link } from 'react-router';
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, withCurrentUser, withMessages } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage, intlShape } from 'react-intl';
|
||||
import Users from 'meteor/nova:users';
|
||||
import { ShowIf, withCurrentUser, withMessages } from 'meteor/nova:core';
|
||||
|
||||
const UsersEditForm = (props, context) => {
|
||||
return (
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, withCurrentUser } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Dropdown, MenuItem } from 'react-bootstrap';
|
||||
import { LinkContainer } from 'react-router-bootstrap';
|
||||
import Users from 'meteor/nova:users';
|
||||
import { withCurrentUser } from 'meteor/nova:core';
|
||||
import { withApollo } from 'react-apollo';
|
||||
|
||||
class UsersMenu extends Component {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import Users from 'meteor/nova:users';
|
||||
import { Link } from 'react-router';
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent, withDocument, withCurrentUser } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import Users from 'meteor/nova:users';
|
||||
import { Link } from 'react-router';
|
||||
import { ShowIf, withDocument, withCurrentUser } from 'meteor/nova:core';
|
||||
|
||||
const UsersProfile = (props) => {
|
||||
if (props.loading) {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import { registerComponent, withCurrentUser } from 'meteor/nova:core';
|
||||
import React, { Component } from 'react';
|
||||
import { Accounts, STATES } from 'meteor/std:accounts-ui';
|
||||
import { T9n } from 'meteor/softwarerero:accounts-t9n';
|
||||
import { Link } from 'react-router';
|
||||
import { withCurrentUser } from 'meteor/nova:core';
|
||||
|
||||
class UsersResetPassword extends Component {
|
||||
componentDidMount() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React from 'react';
|
||||
import Users from 'meteor/nova:users';
|
||||
|
||||
const UsersSingle = (props, context) => {
|
||||
return <Components.UsersProfile userId={props.params._id} slug={props.params.slug} />
|
||||
|
@ -8,4 +7,4 @@ const UsersSingle = (props, context) => {
|
|||
|
||||
UsersSingle.displayName = "UsersSingle";
|
||||
|
||||
registerComponent('UsersSingle', UsersSingle);
|
||||
registerComponent('UsersSingle', UsersSingle);
|
||||
|
|
|
@ -6387,4 +6387,4 @@ a.text-danger:focus, a.text-danger:hover {
|
|||
display: none !important;
|
||||
}
|
||||
}
|
||||
/*# sourceMappingURL=bootstrap.css.map */
|
||||
/*# sourceMappingURL=bootstrap.css.map */
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
// import Posts from "meteor/nova:posts";
|
||||
// import Users from 'meteor/nova:users';
|
||||
// import Categories from "../collection.js";
|
||||
|
||||
// Meteor.publish('categories', function() {
|
||||
|
||||
// const currentUser = this.userId && Users.findOne(this.userId);
|
||||
|
||||
// if(Users.canDo(currentUser, "posts.view.approved.all")){
|
||||
|
||||
// var categories = Categories.find({}, {fields: Categories.publishedFields.list});
|
||||
// var publication = this;
|
||||
|
||||
// categories.forEach(function (category) {
|
||||
// var childrenCategories = category.getChildren();
|
||||
// var categoryIds = [category._id].concat(_.pluck(childrenCategories, "_id"));
|
||||
// var cursor = Posts.find({$and: [{categories: {$in: categoryIds}}, {status: Posts.config.STATUS_APPROVED}]});
|
||||
// // Counts.publish(publication, category.getCounterName(), cursor, { noReady: true });
|
||||
// });
|
||||
|
||||
// return categories;
|
||||
// }
|
||||
// return [];
|
||||
// });
|
|
@ -1,6 +1,4 @@
|
|||
import marked from 'marked';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import Users from 'meteor/nova:users';
|
||||
import { addCallback, Utils } from 'meteor/nova:core';
|
||||
|
||||
// ------------------------------------- comments.edit.sync -------------------------------- //
|
||||
|
|
|
@ -11,8 +11,7 @@ function CommentsNewRateLimit (comment, user) {
|
|||
if (!Users.isAdmin(user)) {
|
||||
const timeSinceLastComment = Users.timeSinceLast(user, Comments);
|
||||
const commentInterval = Math.abs(parseInt(getSetting('commentInterval',15)));
|
||||
console.log(timeSinceLastComment);
|
||||
console.log(commentInterval);
|
||||
|
||||
// check that user waits more than 15 seconds between comments
|
||||
if((timeSinceLastComment < commentInterval)) {
|
||||
throw new Error(Utils.encodeIntlError({id: "comments.rate_limit_error", value: commentInterval-timeSinceLastComment}));
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { removeMutation } from 'meteor/nova:core';
|
||||
import { removeMutation, addCallback } from 'meteor/nova:core';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import Comments from '../collection.js';
|
||||
import Users from 'meteor/nova:users';
|
||||
import { addCallback } from 'meteor/nova:core';
|
||||
|
||||
const CommentsRemovePostCommenters = (comment, currentUser) => {
|
||||
const { userId, postId } = comment;
|
||||
|
@ -45,4 +44,4 @@ const CommentsRemoveChildrenComments = (comment, currentUser) => {
|
|||
return comment;
|
||||
};
|
||||
|
||||
addCallback("comments.remove.async", CommentsRemoveChildrenComments);
|
||||
addCallback("comments.remove.async", CommentsRemoveChildrenComments);
|
||||
|
|
|
@ -3,7 +3,7 @@ import { addCallback } from 'meteor/nova:core';
|
|||
|
||||
function UsersRemoveDeleteComments (user, options) {
|
||||
if (options.deleteComments) {
|
||||
var deletedComments = 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});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// import Telescope from 'meteor/nova:lib';
|
||||
import Comments from './collection.js';
|
||||
import Posts from 'meteor/nova:posts';
|
||||
import Users from 'meteor/nova:users';
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
|
||||
class ContextPasser extends Component {
|
||||
|
||||
getChildContext() {
|
||||
return {
|
||||
closeCallback: this.props.closeCallback,
|
||||
events: this.props.events,
|
||||
messages: this.props.messages,
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
|
||||
ContextPasser.propTypes = {
|
||||
closeCallback: React.PropTypes.func,
|
||||
events: React.PropTypes.object,
|
||||
messages: React.PropTypes.object,
|
||||
};
|
||||
|
||||
ContextPasser.childContextTypes = {
|
||||
closeCallback: React.PropTypes.func,
|
||||
events: React.PropTypes.object,
|
||||
messages: React.PropTypes.object,
|
||||
};
|
||||
|
||||
registerComponent('ContextPasser', ContextPasser);
|
||||
|
||||
export default ContextPasser;
|
||||
module.exports = ContextPasser;
|
|
@ -1,14 +0,0 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import React from 'react';
|
||||
|
||||
const Layout = props => {
|
||||
return (
|
||||
<div>{props.children}</div>
|
||||
);
|
||||
}
|
||||
|
||||
Layout.displayName = "Layout";
|
||||
|
||||
registerComponent('Layout', Layout);
|
||||
|
||||
export default Layout;
|
|
@ -1,6 +1,5 @@
|
|||
import { registerComponent } from 'meteor/nova:lib';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import ContextPasser from './ContextPasser.jsx'
|
||||
import { Modal } from 'react-bootstrap';
|
||||
|
||||
class ModalTrigger extends Component {
|
||||
|
@ -60,4 +59,4 @@ ModalTrigger.defaultProps = {
|
|||
|
||||
registerComponent('ModalTrigger', ModalTrigger);
|
||||
|
||||
export default ModalTrigger;
|
||||
export default ModalTrigger;
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
// import Users from 'meteor/nova:users';
|
||||
// import React from 'react';
|
||||
// import { graphql } from 'react-apollo';
|
||||
// import gql from 'graphql-tag';
|
||||
// import hoistStatics from 'hoist-non-react-statics';
|
||||
// import { Utils } from 'meteor/nova:lib';
|
||||
//
|
||||
// const withApp = WrappedComponent => {
|
||||
//
|
||||
// class WithApp extends React.Component {
|
||||
// constructor(...args) {
|
||||
// super(...args);
|
||||
//
|
||||
// this.preloadedFields = ['_id'];
|
||||
// }
|
||||
//
|
||||
// componentWillMount() {
|
||||
// this.preloadedFields = _.compact(_.map(Users.simpleSchema()._schema, (field, fieldName) => {
|
||||
// return field.preload ? fieldName : undefined;
|
||||
// }));
|
||||
// }
|
||||
//
|
||||
// render() {
|
||||
//
|
||||
// const ComponentWithData = graphql(
|
||||
// gql`query getCurrentUser {
|
||||
// currentUser {
|
||||
// ${this.preloadedFields.join('\n')}
|
||||
// }
|
||||
// }
|
||||
// `, {
|
||||
// options(ownProps) {
|
||||
// return {
|
||||
// variables: {},
|
||||
// // pollInterval: 20000,
|
||||
// };
|
||||
// },
|
||||
// props(props) {
|
||||
// const {data: {loading, currentUser}} = props;
|
||||
// return {
|
||||
// loading,
|
||||
// currentUser,
|
||||
// };
|
||||
// },
|
||||
// }
|
||||
// )(WrappedComponent);
|
||||
//
|
||||
// return <ComponentWithData {...this.props} />
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// WithApp.displayName = `withApp(${Utils.getComponentDisplayName(WrappedComponent)})`
|
||||
// WithApp.WrappedComponent = WrappedComponent
|
||||
//
|
||||
// return hoistStatics(WithApp, WrappedComponent);
|
||||
// };
|
||||
//
|
||||
// export default withApp;
|
|
@ -4,12 +4,10 @@ export { Components, registerComponent, replaceComponent, getRawComponent, getCo
|
|||
import './callbacks.js';
|
||||
|
||||
export { default as App } from "./components/App.jsx";
|
||||
export { default as Layout } from "./components/Layout.jsx";
|
||||
export { default as Icon } from "./components/Icon.jsx";
|
||||
export { default as Loading } from "./components/Loading.jsx";
|
||||
export { default as ShowIf } from "./components/ShowIf.jsx";
|
||||
export { default as ModalTrigger } from './components/ModalTrigger.jsx';
|
||||
export { default as ContextPasser } from './components/ContextPasser.jsx';
|
||||
export { default as withMessages } from "./containers/withMessages.js";
|
||||
export { default as withList } from './containers/withList.js';
|
||||
export { default as withDocument } from './containers/withDocument.js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { Button } from 'react-bootstrap';
|
||||
import NovaEmail from 'meteor/nova:email';
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
/* eslint-disable no-undef */
|
||||
|
||||
import TelescopeImport from 'meteor/nova:lib';
|
||||
import PostsImport from "meteor/nova:posts";
|
||||
import CommentsImport from "meteor/nova:comments";
|
||||
import UsersImport from "meteor/nova:users";
|
||||
import CategoriesImport from "meteor/nova:categories";
|
||||
|
||||
Telescope = TelescopeImport;
|
||||
Posts = PostsImport;
|
||||
Comments = CommentsImport;
|
||||
Users = UsersImport;
|
||||
|
|
|
@ -2,7 +2,7 @@ import NovaEmail from '../namespace.js';
|
|||
import Juice from 'juice';
|
||||
import htmlToText from 'html-to-text';
|
||||
import Handlebars from 'handlebars';
|
||||
import { Utils, getSetting } from 'meteor/nova:lib';
|
||||
import { Utils, getSetting } from 'meteor/nova:lib'; // import from nova:lib because nova:core is not loaded yet
|
||||
|
||||
NovaEmail.templates = {};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent } from 'meteor/nova:lib';
|
||||
import { Components, registerComponent } from 'meteor/nova:core';
|
||||
import { withMutation } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import FRC from 'formsy-react-components';
|
||||
|
|
|
@ -84,8 +84,8 @@ export const requestAnalyticsAsync = (hook, document, user) => {
|
|||
};
|
||||
|
||||
// uncomment for debug
|
||||
console.log(`// dispatching identify on "${hook}" (user ${userId})`);
|
||||
console.log(data);
|
||||
// console.log(`// dispatching identify on "${hook}" (user ${userId})`);
|
||||
// console.log(data);
|
||||
|
||||
analytics.identify(data);
|
||||
|
||||
|
@ -100,8 +100,8 @@ export const requestAnalyticsAsync = (hook, document, user) => {
|
|||
};
|
||||
|
||||
// uncomment for debug
|
||||
console.log(`// dispatching track on "${hook}"`);
|
||||
console.log(data);
|
||||
// console.log(`// dispatching track on "${hook}"`);
|
||||
// console.log(data);
|
||||
|
||||
analytics.track(data);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ addStrings('en', {
|
|||
"posts.unsubscribed": "You have unsubscribed from “{name}” comments.",
|
||||
"posts.subscribed_posts" : "Posts subscribed to",
|
||||
"posts.link_already_posted": "This link has already been posted.",
|
||||
"posts.max_per_day": "Sorry you cannot submit more than {value} posts per day.",
|
||||
|
||||
"comments.comments": "Comments",
|
||||
"comments.count": "{count, plural, =0 {No comments} one {# comment} other {# comments}}",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Components } from 'meteor/nova:lib';
|
||||
import { Components, withMessages } from 'meteor/nova:core';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import { withMessages } from 'meteor/nova:core';
|
||||
import { intlShape } from 'react-intl';
|
||||
|
||||
// this component is used as a custom controller in user's account edit (cf. ./custom_fields.js)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Telescope from 'meteor/nova:core';
|
||||
import Posts from '../collection.js'
|
||||
import Users from 'meteor/nova:users';
|
||||
import { addCallback } from 'meteor/nova:core';
|
||||
|
|
|
@ -27,7 +27,7 @@ function PostsNewRateLimit (post, user) {
|
|||
|
||||
// check that the user doesn't post more than Y posts per day
|
||||
if(numberOfPostsInPast24Hours > maxPostsPer24Hours)
|
||||
throw new Error(605, 'sorry_you_cannot_submit_more_than'+maxPostsPer24Hours+'posts_per_day');
|
||||
throw new Error(Utils.encodeIntlError({id: "posts.max_per_day", value: postInterval-timeSinceLastPost}));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -3,4 +3,7 @@ import Posts from './modules.js';
|
|||
import './server/routes.js';
|
||||
import './server/cron.js';
|
||||
|
||||
export default Posts;
|
||||
// index
|
||||
Posts._ensureIndex({"status": 1, "postedAt": 1});
|
||||
|
||||
export default Posts;
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
// import Comments from "meteor/nova:comments";
|
||||
import Users from 'meteor/nova:users';
|
||||
import { Counts } from 'meteor/tmeasday:publish-counts';
|
||||
import Posts from '../collection.js';
|
||||
import { runCallbacks } from 'meteor/nova:core';
|
||||
|
||||
Posts._ensureIndex({"status": 1, "postedAt": 1});
|
||||
|
||||
// ------------------------------------- Helpers -------------------------------- //
|
||||
|
||||
/**
|
||||
* @summary Get all users relevant to a list of posts
|
||||
* (authors of the listed posts, and first four commenters of each post)
|
||||
* @param {Object} posts
|
||||
*/
|
||||
const getPostsListUsers = posts => {
|
||||
|
||||
// add the userIds of each post authors
|
||||
let userIds = _.pluck(posts.fetch(), 'userId');
|
||||
|
||||
// for each post, also add first four commenter's userIds to userIds array
|
||||
posts.forEach(function (post) {
|
||||
userIds = userIds.concat(_.first(post.commenters,4));
|
||||
});
|
||||
|
||||
userIds = _.unique(userIds);
|
||||
|
||||
return Users.find({_id: {$in: userIds}}, {fields: Users.publishedFields.list});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get all users relevant to a single post
|
||||
* (author of the current post, authors of its comments, and upvoters & downvoters of the post)
|
||||
* @param {Object} post
|
||||
*/
|
||||
const getSinglePostUsers = post => {
|
||||
|
||||
let users = [post.userId]; // publish post author's ID
|
||||
|
||||
/*
|
||||
NOTE: to avoid circular dependencies between nova:posts and nova:comments,
|
||||
use callback hook to get comment authors
|
||||
*/
|
||||
users = runCallbacks("posts.single.getUsers", users, post);
|
||||
|
||||
// add upvoters
|
||||
if (post.upvoters && post.upvoters.length) {
|
||||
users = users.concat(post.upvoters);
|
||||
}
|
||||
|
||||
// add downvoters
|
||||
if (post.downvoters && post.downvoters.length) {
|
||||
users = users.concat(post.downvoters);
|
||||
}
|
||||
|
||||
// remove any duplicate IDs
|
||||
users = _.unique(users);
|
||||
|
||||
return Users.find({_id: {$in: users}}, {fields: Users.publishedFields.list});
|
||||
};
|
||||
|
||||
// ------------------------------------- Publications -------------------------------- //
|
||||
|
||||
/**
|
||||
* @summary Publish a list of posts, along with the users corresponding to these posts
|
||||
* @param {Object} terms
|
||||
*/
|
||||
// Meteor.publish('posts.list', function (terms) {
|
||||
//
|
||||
// // this.unblock(); // causes bug where publication returns 0 results
|
||||
//
|
||||
// this.autorun(function () {
|
||||
//
|
||||
// const currentUser = this.userId && Users.findOne(this.userId);
|
||||
//
|
||||
// terms.currentUserId = this.userId; // add currentUserId to terms
|
||||
// const {selector, options} = Posts.getParameters(terms);
|
||||
//
|
||||
// Counts.publish(this, terms.listId, Posts.find(selector, options), {noReady: true});
|
||||
//
|
||||
// options.fields = Posts.publishedFields.list;
|
||||
//
|
||||
// const posts = Posts.find(selector, options);
|
||||
//
|
||||
// // note: doesn't work yet :(
|
||||
// // CursorCounts.set(terms, posts.count(), this.connection.id);
|
||||
//
|
||||
// const users = Tracker.nonreactive(function () {
|
||||
// return getPostsListUsers(posts);
|
||||
// });
|
||||
//
|
||||
// return Users.canDo(currentUser, "posts.view.approved.all") ? [posts, users] : [];
|
||||
//
|
||||
// });
|
||||
//
|
||||
// });
|
||||
//
|
||||
// /**
|
||||
// * @summary Publish a single post, along with all relevant users
|
||||
// * @param {Object} terms
|
||||
// */
|
||||
// Meteor.publish('posts.single', function (terms) {
|
||||
//
|
||||
// check(terms, Match.OneOf({_id: String}, {_id: String, slug: Match.Any}));
|
||||
//
|
||||
// const currentUser = this.userId && Users.findOne(this.userId);
|
||||
// const options = {fields: Posts.publishedFields.single};
|
||||
// const posts = Posts.find(terms._id, options);
|
||||
// const post = posts.fetch()[0];
|
||||
//
|
||||
// if (post) {
|
||||
// const users = getSinglePostUsers(post);
|
||||
// return Users.canView(currentUser, post) ? [posts, users] : [];
|
||||
// } else {
|
||||
// console.log(`// posts.single: no post found for _id “${terms._id}”`); // eslint-disable-line
|
||||
// return [];
|
||||
// }
|
||||
//
|
||||
// });
|
|
@ -1,5 +1,5 @@
|
|||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
import { Callbacks, addCallback, Utils } from 'meteor/nova:core';
|
||||
import { addCallback, Utils } from 'meteor/nova:core';
|
||||
|
||||
function addSearchQueryParameter (parameters, terms) {
|
||||
if(!!terms.query) {
|
||||
|
@ -21,4 +21,4 @@ function addSearchQueryParameter (parameters, terms) {
|
|||
}
|
||||
return parameters;
|
||||
}
|
||||
addCallback("posts.parameters", addSearchQueryParameter);
|
||||
addCallback("posts.parameters", addSearchQueryParameter);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Telescope from 'meteor/nova:lib';
|
||||
import Users from 'meteor/nova:users';
|
||||
import { Callbacks, addCallback } from 'meteor/nova:core';
|
||||
import { addCallback } from 'meteor/nova:core';
|
||||
|
||||
// note: even if all these callbacks are async, they are imported on the client so they pop in the cheatsheet when debug is enabled
|
||||
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
// import Telescope from 'meteor/nova:lib';
|
||||
// import React, { PropTypes, Component } from 'react';
|
||||
// import { ListContainer } from "meteor/utilities:react-list-container";
|
||||
// import Posts from "meteor/nova:posts";
|
||||
|
||||
// class PostsSubscribedList extends Component {
|
||||
|
||||
// render() {
|
||||
|
||||
// const params = {view: 'userSubscribedPosts', userId: Meteor.userId(), listId: "posts.list.subscribed"};
|
||||
// const {selector, options} = Posts.getParameters(params);
|
||||
|
||||
// return (
|
||||
// <ListContainer
|
||||
// collection={Posts}
|
||||
// publication="posts.list"
|
||||
// selector={selector}
|
||||
// options={options}
|
||||
// terms={params}
|
||||
// joins={Posts.getJoins()}
|
||||
// component={Telescope.components.PostsList}
|
||||
// cacheSubscription={false}
|
||||
// listId={params.listId}
|
||||
// limit={Telescope.settings.get("postsPerPage", 10)}
|
||||
// />
|
||||
// )
|
||||
// }
|
||||
// };
|
||||
|
||||
// module.exports = PostsSubscribedList;
|
|
@ -25,4 +25,4 @@ const Users = createCollection({
|
|||
|
||||
GraphQLSchema.addQuery(`currentUser: User`);
|
||||
|
||||
export default Users;
|
||||
export default Users;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { GraphQLSchema } from 'meteor/nova:lib';
|
||||
import { GraphQLSchema } from 'meteor/nova:core';
|
||||
|
||||
const specificResolvers = {
|
||||
Post: {
|
||||
|
|
Loading…
Add table
Reference in a new issue