Merge branch 'master' into gdpr-email

This commit is contained in:
Wyatt Johnson
2018-05-03 15:18:22 -06:00
51 changed files with 1689 additions and 63 deletions
@@ -57,7 +57,7 @@ class OrganizationSettings extends React.Component {
}
const updater = { organizationContactEmail: { $set: email } };
const errorUpdater = { organizationEmail: { $set: error } };
const errorUpdater = { organizationContactEmail: { $set: error } };
this.props.updatePending({ updater, errorUpdater });
};
@@ -27,6 +27,7 @@ import {
getActionSummary,
iPerformedThisAction,
isCommentActive,
isCommentDeleted,
getShallowChanges,
} from 'coral-framework/utils';
import t from 'coral-framework/services/i18n';
@@ -744,8 +745,14 @@ export default class Comment extends React.Component {
return (
<div className={rootClassName} id={id}>
{this.renderComment()}
{activeReplyBox === comment.id && this.renderReplyBox()}
{isCommentDeleted(comment) ? (
<CommentTombstone action="deleted" />
) : (
<div>
{this.renderComment()}
{activeReplyBox === comment.id && this.renderReplyBox()}
</div>
)}
{this.renderRepliesContainer()}
</div>
);
@@ -13,6 +13,8 @@ class CommentTombstone extends React.Component {
return t('framework.comment_is_ignored');
case 'reject':
return t('framework.comment_is_rejected');
case 'deleted':
return t('framework.comment_is_deleted');
default:
return t('framework.comment_is_hidden');
}
@@ -372,6 +372,7 @@ const slots = [
'streamTabsPrepend',
'streamTabPanes',
'streamFilter',
'stream',
];
const fragments = {
+8
View File
@@ -1,6 +1,7 @@
import { gql } from 'react-apollo';
import t from 'coral-framework/services/i18n';
import union from 'lodash/union';
import get from 'lodash/get';
import { capitalize } from 'coral-framework/helpers/strings';
import assignWith from 'lodash/assignWith';
import mapValues from 'lodash/mapValues';
@@ -221,6 +222,13 @@ export function isCommentActive(commentStatus) {
return ['NONE', 'ACCEPTED'].indexOf(commentStatus) >= 0;
}
export function isCommentDeleted(comment) {
return (
get(comment, 'body', null) === null ||
get(comment, 'deleted_at', null) !== null
);
}
export function getShallowChanges(a, b) {
return union(Object.keys(a), Object.keys(b)).filter(key => a[key] !== b[key]);
}