mirror of
https://github.com/wassname/talk.git
synced 2026-08-15 12:55:10 +08:00
Refactor
This commit is contained in:
+3
-19
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import { gql } from 'react-apollo';
|
||||
import { subscriptionFields } from 'coral-admin/src/routes/Moderation/graphql';
|
||||
|
||||
class ModIndicatorSubscription extends React.Component {
|
||||
subscriptions = null;
|
||||
@@ -39,28 +40,11 @@ class ModIndicatorSubscription extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const fields = `
|
||||
status
|
||||
actions {
|
||||
__typename
|
||||
created_at
|
||||
}
|
||||
status_history {
|
||||
type
|
||||
assigned_by {
|
||||
id
|
||||
}
|
||||
created_at
|
||||
}
|
||||
updated_at
|
||||
created_at
|
||||
`;
|
||||
|
||||
const COMMENT_FEATURED_SUBSCRIPTION = gql`
|
||||
subscription TalkFeaturedComments_Indicator_CommentFeatured {
|
||||
commentFeatured {
|
||||
comment {
|
||||
${fields}
|
||||
${subscriptionFields}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,7 +54,7 @@ const COMMENT_UNFEATURED_SUBSCRIPTION = gql`
|
||||
subscription TalkFeaturedComments_Indicator_CommentUnfeatured {
|
||||
commentUnfeatured {
|
||||
comment {
|
||||
${fields}
|
||||
${subscriptionFields}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import Comment from 'coral-admin/src/routes/Moderation/containers/Comment';
|
||||
import { getDefinitionName } from 'coral-framework/utils';
|
||||
import truncate from 'lodash/truncate';
|
||||
import t from 'coral-framework/services/i18n';
|
||||
import { subscriptionFields } from 'coral-admin/src/routes/Moderation/graphql';
|
||||
|
||||
function prepareNotificationText(text) {
|
||||
return truncate(text, { length: 50 }).replace('\n', ' ');
|
||||
@@ -74,29 +75,12 @@ class ModSubscription extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const fields = `
|
||||
status
|
||||
actions {
|
||||
__typename
|
||||
created_at
|
||||
}
|
||||
status_history {
|
||||
type
|
||||
assigned_by {
|
||||
id
|
||||
}
|
||||
created_at
|
||||
}
|
||||
updated_at
|
||||
created_at
|
||||
`;
|
||||
|
||||
const COMMENT_FEATURED_SUBSCRIPTION = gql`
|
||||
subscription CommentFeatured($assetId: ID){
|
||||
commentFeatured(asset_id: $assetId) {
|
||||
comment {
|
||||
...${getDefinitionName(Comment.fragments.comment)}
|
||||
${fields}
|
||||
${subscriptionFields}
|
||||
}
|
||||
user {
|
||||
id
|
||||
@@ -112,7 +96,7 @@ const COMMENT_UNFEATURED_SUBSCRIPTION = gql`
|
||||
commentUnfeatured(asset_id: $assetId){
|
||||
comment {
|
||||
...${getDefinitionName(Comment.fragments.comment)}
|
||||
${fields}
|
||||
${subscriptionFields}
|
||||
}
|
||||
user {
|
||||
id
|
||||
|
||||
Reference in New Issue
Block a user