mirror of
https://github.com/wassname/talk.git
synced 2026-07-15 11:26:58 +08:00
Error reporting for the rest
This commit is contained in:
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
|
||||
import LoadMore from './LoadMore';
|
||||
import NewCount from './NewCount';
|
||||
import { TransitionGroup } from 'react-transition-group';
|
||||
import { forEachError } from 'coral-framework/utils';
|
||||
import Comment from '../containers/Comment';
|
||||
import NoComments from './NoComments';
|
||||
|
||||
@@ -91,11 +90,8 @@ class AllCommentsPane extends React.Component {
|
||||
.then(() => {
|
||||
this.setState({ loadingState: 'success' });
|
||||
})
|
||||
.catch(error => {
|
||||
.catch(() => {
|
||||
this.setState({ loadingState: 'error' });
|
||||
forEachError(error, ({ msg }) => {
|
||||
this.props.notify('error', msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import { EditableCommentContent } from './EditableCommentContent';
|
||||
import {
|
||||
getActionSummary,
|
||||
iPerformedThisAction,
|
||||
forEachError,
|
||||
isCommentActive,
|
||||
getShallowChanges,
|
||||
} from 'coral-framework/utils';
|
||||
@@ -261,11 +260,8 @@ export default class Comment extends React.Component {
|
||||
loadingState: 'success',
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
.catch(() => {
|
||||
this.setState({ loadingState: 'error' });
|
||||
forEachError(error, ({ msg }) => {
|
||||
this.props.notify('error', msg);
|
||||
});
|
||||
});
|
||||
emit('ui.Comment.showMoreReplies', { id });
|
||||
return;
|
||||
|
||||
@@ -6,7 +6,6 @@ import styles from './Comment.css';
|
||||
import { CountdownSeconds } from './CountdownSeconds';
|
||||
import { getEditableUntilDate } from './util';
|
||||
import { can } from 'coral-framework/services/perms';
|
||||
import { forEachError } from 'coral-framework/utils';
|
||||
|
||||
import { Icon } from 'coral-ui';
|
||||
import t from 'coral-framework/services/i18n';
|
||||
@@ -80,7 +79,7 @@ export class EditableCommentContent extends React.Component {
|
||||
|
||||
this.setState({ loadingState: 'loading' });
|
||||
|
||||
const { editComment, notify, stopEditing } = this.props;
|
||||
const { editComment, stopEditing } = this.props;
|
||||
if (typeof editComment !== 'function') {
|
||||
return;
|
||||
}
|
||||
@@ -95,7 +94,6 @@ export class EditableCommentContent extends React.Component {
|
||||
}
|
||||
} catch (error) {
|
||||
this.setState({ loadingState: 'error' });
|
||||
forEachError(error, ({ msg }) => notify('error', msg));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { StreamError } from './StreamError';
|
||||
import StreamError from './StreamError';
|
||||
import Comment from '../containers/Comment';
|
||||
import BannedAccount from '../../../components/BannedAccount';
|
||||
import ChangeUsername from '../containers/ChangeUsername';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import styles from './StreamError.css';
|
||||
|
||||
export const StreamError = ({ children }) => (
|
||||
export default ({ children }) => (
|
||||
<div className={styles.streamError}>{children}</div>
|
||||
);
|
||||
|
||||
@@ -38,6 +38,7 @@ import {
|
||||
insertFetchedCommentsIntoEmbedQuery,
|
||||
nest,
|
||||
} from '../../../graphql/utils';
|
||||
import StreamError from '../components/StreamError';
|
||||
|
||||
const { showSignInDialog, editName } = authActions;
|
||||
const { notify } = notificationActions;
|
||||
@@ -208,6 +209,10 @@ class StreamContainer extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.props.data.error) {
|
||||
return <StreamError>{this.props.data.error.message}</StreamError>;
|
||||
}
|
||||
|
||||
if (
|
||||
!this.props.asset ||
|
||||
(this.props.asset.comment === undefined && !this.props.asset.comments)
|
||||
@@ -424,7 +429,8 @@ export default compose(
|
||||
withEmit,
|
||||
connect(mapStateToProps, mapDispatchToProps),
|
||||
withPostComment,
|
||||
withPostFlag,
|
||||
// `talk-plugin-flags` has a custom error handling logic.
|
||||
withPostFlag({ notifyOnError: false }),
|
||||
withPostDontAgree,
|
||||
withDeleteAction,
|
||||
withEditComment
|
||||
|
||||
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
|
||||
|
||||
import t from 'coral-framework/services/i18n';
|
||||
import { can } from 'coral-framework/services/perms';
|
||||
import { forEachError } from 'coral-framework/utils';
|
||||
|
||||
import Slot from 'coral-framework/components/Slot';
|
||||
import { connect } from 'react-redux';
|
||||
@@ -93,9 +92,8 @@ class CommentBox extends React.Component {
|
||||
commentPostedHandler();
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
.catch(() => {
|
||||
this.setState({ loadingState: 'error' });
|
||||
forEachError(err, ({ msg }) => notify('error', msg));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Comment from './Comment';
|
||||
import LoadMore from './LoadMore';
|
||||
import { forEachError } from 'plugin-api/beta/client/utils';
|
||||
|
||||
class CommentHistory extends React.Component {
|
||||
state = {
|
||||
@@ -16,11 +15,8 @@ class CommentHistory extends React.Component {
|
||||
.then(() => {
|
||||
this.setState({ loadingState: 'success' });
|
||||
})
|
||||
.catch(error => {
|
||||
.catch(() => {
|
||||
this.setState({ loadingState: 'error' });
|
||||
forEachError(error, ({ msg }) => {
|
||||
this.props.notify('error', msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -55,7 +51,6 @@ class CommentHistory extends React.Component {
|
||||
CommentHistory.propTypes = {
|
||||
comments: PropTypes.object.isRequired,
|
||||
loadMore: PropTypes.func,
|
||||
notify: PropTypes.func,
|
||||
link: PropTypes.func,
|
||||
data: PropTypes.object,
|
||||
root: PropTypes.object,
|
||||
|
||||
Reference in New Issue
Block a user