Merge branch 'user-status-refactor' of github.com:coralproject/talk into user-status-refactor

* 'user-status-refactor' of github.com:coralproject/talk:
  added mount path to the endpoint to respect the mounting config
  linting
  removed dev requirement for engine
This commit is contained in:
okbel
2017-12-20 21:14:21 -03:00
9 changed files with 63 additions and 46 deletions
@@ -19,6 +19,7 @@ class PeopleContainer extends React.Component {
onKeyDownHandler = (e) => {
if (e.key === 'Enter') {
e.preventDefault();
// this.fetchUsers();
}
}
@@ -152,6 +152,7 @@ class ModerationQueue extends React.Component {
nextComments &&
nextComments.length < prevComments.length
) {
// Invalidate first cursor if referenced comment was removed.
if (
this.state.idCursors[0] &&
@@ -111,10 +111,10 @@ class ModerationContainer extends Component {
this.props.auth.user.id === user.id
? ''
: t(
'modqueue.notify_accepted',
user.username,
prepareNotificationText(comment.body)
);
'modqueue.notify_accepted',
user.username,
prepareNotificationText(comment.body)
);
return this.handleCommentChange(prev, comment, notifyText);
},
},
@@ -132,10 +132,10 @@ class ModerationContainer extends Component {
this.props.auth.user.id === user.id
? ''
: t(
'modqueue.notify_rejected',
user.username,
prepareNotificationText(comment.body)
);
'modqueue.notify_rejected',
user.username,
prepareNotificationText(comment.body)
);
return this.handleCommentChange(prev, comment, notifyText);
},
},
@@ -153,10 +153,10 @@ class ModerationContainer extends Component {
this.props.auth.user.id === user.id
? ''
: t(
'modqueue.notify_reset',
user.username,
prepareNotificationText(comment.body)
);
'modqueue.notify_reset',
user.username,
prepareNotificationText(comment.body)
);
return this.handleCommentChange(prev, comment, notifyText);
},
},
@@ -207,6 +207,7 @@ class ModerationContainer extends Component {
}
componentWillReceiveProps(nextProps) {
// Resubscribe when we change between assets.
if (
this.props.data.variables.asset_id !== nextProps.data.variables.asset_id
@@ -275,12 +276,14 @@ class ModerationContainer extends Component {
if (assetId) {
if (asset === null) {
// Not found.
return <NotFoundAsset assetId={assetId} />;
}
}
if (data.loading) {
// loading.
return <Spinner />;
}
@@ -424,23 +427,23 @@ const withModQueueQuery = withQuery(
({queueConfig}) => gql`
query CoralAdmin_Moderation($asset_id: ID, $sortOrder: SORT_ORDER, $allAssets: Boolean!, $nullStatuses: [COMMENT_STATUS!]) {
${Object.keys(queueConfig).map(
(queue) => `
(queue) => `
${queue}: comments(query: {
statuses: ${
queueConfig[queue].statuses
? `[${queueConfig[queue].statuses.join(', ')}],`
: '$nullStatuses'
}
queueConfig[queue].statuses
? `[${queueConfig[queue].statuses.join(', ')}],`
: '$nullStatuses'
}
${
queueConfig[queue].tags
? `tags: ["${queueConfig[queue].tags.join('", "')}"],`
: ''
}
queueConfig[queue].tags
? `tags: ["${queueConfig[queue].tags.join('", "')}"],`
: ''
}
${
queueConfig[queue].action_type
? `action_type: ${queueConfig[queue].action_type}`
: ''
}
queueConfig[queue].action_type
? `action_type: ${queueConfig[queue].action_type}`
: ''
}
asset_id: $asset_id,
sortOrder: $sortOrder,
limit: 20,
@@ -448,29 +451,29 @@ const withModQueueQuery = withQuery(
...CoralAdmin_Moderation_CommentConnection
}
`
)}
)}
${Object.keys(queueConfig).map(
(queue) => `
(queue) => `
${queue}Count: commentCount(query: {
statuses: ${
queueConfig[queue].statuses
? `[${queueConfig[queue].statuses.join(', ')}],`
: '$nullStatuses'
}
queueConfig[queue].statuses
? `[${queueConfig[queue].statuses.join(', ')}],`
: '$nullStatuses'
}
${
queueConfig[queue].tags
? `tags: ["${queueConfig[queue].tags.join('", "')}"],`
: ''
}
queueConfig[queue].tags
? `tags: ["${queueConfig[queue].tags.join('", "')}"],`
: ''
}
${
queueConfig[queue].action_type
? `action_type: ${queueConfig[queue].action_type}`
: ''
}
queueConfig[queue].action_type
? `action_type: ${queueConfig[queue].action_type}`
: ''
}
asset_id: $asset_id,
})
`
)}
)}
asset(id: $asset_id) @skip(if: $allAssets) {
id
title
@@ -50,6 +50,7 @@ class StreamContainer extends React.Component {
assetId: this.props.asset.id,
},
updateQuery: (prev, {subscriptionData: {data: {commentEdited}}}) => {
// Ignore mutations from me.
// TODO: need way to detect mutations created by this client, and allow mutations from other clients.
if (
@@ -82,6 +83,7 @@ class StreamContainer extends React.Component {
assetId: this.props.asset.id,
},
updateQuery: (prev, {subscriptionData: {data: {commentAdded}}}) => {
// Ignore mutations from me.
// TODO: need way to detect mutations created by this client, and allow mutations from other clients.
if (
@@ -338,14 +340,14 @@ const fragments = {
comment(id: $commentId) @include(if: $hasComment) {
...CoralEmbedStream_Stream_comment
${nest(
`
`
parent {
...CoralEmbedStream_Stream_comment
...nest
}
`,
THREADING_LEVEL
)}
THREADING_LEVEL
)}
}
id
title
+1
View File
@@ -45,6 +45,7 @@ export const can = (user, ...perms) => {
}
return perms.every((perm) => {
// Basic Permissions
const permAction = basicPerms[perm];
if (typeof permAction !== 'undefined') {