Merge branch 'master' into view-context-no-tombstone

This commit is contained in:
Wyatt Johnson
2017-09-15 17:16:07 -06:00
committed by GitHub
23 changed files with 357 additions and 136 deletions
+2 -4
View File
@@ -4,10 +4,8 @@ export const viewUserDetail = (userId) => ({type: actions.VIEW_USER_DETAIL, user
export const hideUserDetail = () => ({type: actions.HIDE_USER_DETAIL});
export const changeUserDetailStatuses = (tab) => {
let statuses;
if (tab === 'all') {
statuses = ['NONE', 'ACCEPTED', 'REJECTED', 'PREMOD'];
} else if (tab === 'rejected') {
let statuses = [];
if (tab === 'rejected') {
statuses = ['REJECTED'];
}
return {type: actions.CHANGE_USER_DETAIL_STATUSES, tab, statuses};
@@ -3,7 +3,7 @@ import * as actions from '../constants/userDetail';
const initialState = {
userId: null,
activeTab: 'all',
statuses: ['NONE', 'ACCEPTED', 'REJECTED', 'PREMOD'],
statuses: [],
selectedCommentIds: [],
};
@@ -13,7 +13,7 @@ export default {
},
reported: {
action_type: 'FLAG',
statuses: ['NONE', 'PREMOD'],
statuses: ['NONE', 'PREMOD', 'SYSTEM_WITHHELD'],
icon: 'flag',
name: t('modqueue.reported'),
},
@@ -201,7 +201,7 @@ class Stream extends React.Component {
data,
root,
appendItemArray,
root: {asset, asset: {comment: highlightedComment, comments}},
root: {asset, asset: {comment: highlightedComment}},
postComment,
notify,
updateItem,
@@ -222,9 +222,8 @@ class Stream extends React.Component {
const slotProps = {data};
const slotQueryData = {root, asset};
if (!highlightedComment && !comments) {
console.error('Talk: No comments came back from the graph given that query. Please, check the query params.');
return <StreamError />;
if (highlightedComment === null) {
return <StreamError>{t('stream.comment_not_found')}</StreamError>;
}
return (
@@ -1,9 +1,8 @@
import React from 'react';
import styles from './StreamError.css';
import t from 'coral-framework/services/i18n';
export const StreamError = () => (
export const StreamError = ({children}) => (
<div className={styles.streamError}>
{t('common.error')}
{children}
</div>
);
@@ -51,7 +51,7 @@ class StreamContainer extends React.Component {
return prev;
}
if (['PREMOD', 'REJECTED'].includes(commentEdited.status)) {
if (['PREMOD', 'REJECTED', 'SYSTEM_WITHHELD'].includes(commentEdited.status)) {
return removeCommentFromEmbedQuery(prev, commentEdited.id);
}
},
@@ -178,7 +178,7 @@ class StreamContainer extends React.Component {
render() {
if (!this.props.root.asset
|| !this.props.root.asset.comment
|| this.props.root.asset.comment === undefined
&& !this.props.root.asset.comments
) {
return <Spinner />;
+10 -2
View File
@@ -77,6 +77,14 @@ export default {
title
url
}
actions {
__typename
id
... on FlagAction {
reason
message
}
}
tags {
tag {
name
@@ -166,7 +174,7 @@ export default {
},
updateQueries: {
CoralEmbedStream_Embed: (prev, {mutationResult: {data: {createComment: {comment}}}}) => {
if (prev.asset.settings.moderation === 'PRE' || comment.status === 'PREMOD' || comment.status === 'REJECTED') {
if (prev.asset.settings.moderation === 'PRE' || comment.status === 'PREMOD' || comment.status === 'REJECTED' || comment.status === 'SYSTEM_WITHHELD') {
return prev;
}
return insertCommentIntoEmbedQuery(prev, comment);
@@ -185,7 +193,7 @@ export default {
EditComment: () => ({
updateQueries: {
CoralEmbedStream_Embed: (prev, {mutationResult: {data: {editComment: {comment}}}}) => {
if (!['PREMOD', 'REJECTED'].includes(comment.status)) {
if (!['PREMOD', 'REJECTED', 'SYSTEM_WITHHELD'].includes(comment.status)) {
return null;
}
return removeCommentFromEmbedQuery(prev, comment.id);
+1 -1
View File
@@ -42,7 +42,7 @@ function preInit({store, pym}) {
return new Promise((resolve) => {
pym.sendMessage('getConfig');
pym.onMessage('config', (config) => {
store.dispatch(addExternalConfig(config));
store.dispatch(addExternalConfig(JSON.parse(config)));
store.dispatch(checkLogin());
resolve();
});
+4 -4
View File
@@ -13,10 +13,10 @@ export const name = 'talk-plugin-commentbox';
// Given a newly posted comment's status, show a notification to the user
// if needed
export const notifyForNewCommentStatus = (notify, status) => {
if (status === 'REJECTED') {
export const notifyForNewCommentStatus = (notify, comment) => {
if (comment.status === 'REJECTED') {
notify('error', t('comment_box.comment_post_banned_word'));
} else if (status === 'PREMOD') {
} else if (comment.status === 'PREMOD' || comment.status === 'SYSTEM_WITHHELD') {
notify('success', t('comment_box.comment_post_notif_premod'));
}
};
@@ -74,7 +74,7 @@ class CommentBox extends React.Component {
// Execute postSubmit Hooks
this.state.hooks.postSubmit.forEach((hook) => hook(data));
notifyForNewCommentStatus(notify, postedComment.status);
notifyForNewCommentStatus(notify, postedComment);
if (commentPostedHandler) {
commentPostedHandler();