mirror of
https://github.com/wassname/talk.git
synced 2026-07-17 11:33:39 +08:00
Harmonize naming in admin and embed-stream
This commit is contained in:
@@ -4,14 +4,14 @@ const queues = ['all', 'premod', 'flagged', 'accepted', 'rejected'];
|
||||
const extension = {
|
||||
mutations: {
|
||||
SetUserStatus: () => ({
|
||||
refetchQueries: ['Admin_Community'],
|
||||
refetchQueries: ['CoralAdmin_Community'],
|
||||
}),
|
||||
RejectUsername: () => ({
|
||||
refetchQueries: ['Admin_Community'],
|
||||
refetchQueries: ['CoralAdmin_Community'],
|
||||
}),
|
||||
SetCommentStatus: ({variables: {commentId, status}}) => ({
|
||||
updateQueries: {
|
||||
Admin_Moderation: (oldData) => {
|
||||
CoralAdmin_Moderation: (oldData) => {
|
||||
const comment = queues.reduce((comment, queue) => {
|
||||
return comment ? comment : oldData[queue].find((c) => c.id === commentId);
|
||||
}, null);
|
||||
|
||||
@@ -48,7 +48,7 @@ class CommunityContainer extends Component {
|
||||
}
|
||||
|
||||
export const withCommunityQuery = withQuery(gql`
|
||||
query Admin_Community($action_type: ACTION_TYPE) {
|
||||
query CoralAdmin_Community($action_type: ACTION_TYPE) {
|
||||
users(query:{action_type: $action_type}){
|
||||
id
|
||||
username
|
||||
|
||||
@@ -21,15 +21,15 @@ class DashboardContainer extends React.Component {
|
||||
}
|
||||
|
||||
export const witDashboardQuery = withQuery(gql`
|
||||
query Admin_Dashboard($from: Date!, $to: Date!) {
|
||||
query CoralAdmin_Dashboard($from: Date!, $to: Date!) {
|
||||
assetsByFlag: assetMetrics(from: $from, to: $to, sort: FLAG) {
|
||||
...Admin_Metrics
|
||||
...CoralAdmin_Metrics
|
||||
}
|
||||
assetsByActivity: assetMetrics(from: $from, to: $to, sort: ACTIVITY) {
|
||||
...Admin_Metrics
|
||||
...CoralAdmin_Metrics
|
||||
}
|
||||
}
|
||||
fragment Admin_Metrics on Asset {
|
||||
fragment CoralAdmin_Metrics on Asset {
|
||||
id
|
||||
title
|
||||
url
|
||||
|
||||
@@ -12,14 +12,14 @@ const pluginFragments = getSlotsFragments([
|
||||
|
||||
export default withFragments({
|
||||
root: gql`
|
||||
fragment Admin_Moderation_Comment_root on RootQuery {
|
||||
fragment CoralAdmin_ModerationComment_root on RootQuery {
|
||||
__typename
|
||||
${pluginFragments.spreads('root')}
|
||||
}
|
||||
${pluginFragments.definitions('root')}
|
||||
`,
|
||||
comment: gql`
|
||||
fragment Admin_Moderation_Comment_comment on Comment {
|
||||
fragment CoralAdmin_ModerationComment_comment on Comment {
|
||||
id
|
||||
body
|
||||
created_at
|
||||
|
||||
@@ -113,7 +113,7 @@ class ModerationContainer extends Component {
|
||||
}
|
||||
|
||||
const LOAD_MORE_QUERY = gql`
|
||||
query Admin_Moderation_LoadMore($limit: Int = 10, $cursor: Date, $sort: SORT_ORDER, $asset_id: ID, $statuses:[COMMENT_STATUS!], $action_type: ACTION_TYPE) {
|
||||
query CoralAdmin_Moderation_LoadMore($limit: Int = 10, $cursor: Date, $sort: SORT_ORDER, $asset_id: ID, $statuses:[COMMENT_STATUS!], $action_type: ACTION_TYPE) {
|
||||
comments(query: {limit: $limit, cursor: $cursor, asset_id: $asset_id, statuses: $statuses, sort: $sort, action_type: $action_type}) {
|
||||
...${getDefinitionName(Comment.fragments.comment)}
|
||||
action_summaries {
|
||||
@@ -128,7 +128,7 @@ const LOAD_MORE_QUERY = gql`
|
||||
`;
|
||||
|
||||
const withModQueueQuery = withQuery(gql`
|
||||
query Admin_Moderation($asset_id: ID, $sort: SORT_ORDER) {
|
||||
query CoralAdmin_Moderation($asset_id: ID, $sort: SORT_ORDER) {
|
||||
all: comments(query: {
|
||||
statuses: [NONE, PREMOD, ACCEPTED, REJECTED],
|
||||
asset_id: $asset_id,
|
||||
@@ -207,7 +207,7 @@ const withModQueueQuery = withQuery(gql`
|
||||
});
|
||||
|
||||
const withQueueCountPolling = withQuery(gql`
|
||||
query Admin_Moderation_CountPoll($asset_id: ID) {
|
||||
query CoralAdmin_ModerationCountPoll($asset_id: ID) {
|
||||
allCount: commentCount(query: {
|
||||
asset_id: $asset_id
|
||||
})
|
||||
|
||||
@@ -24,7 +24,7 @@ class UserDetailContainer extends React.Component {
|
||||
}
|
||||
|
||||
export const withUserDetailQuery = withQuery(gql`
|
||||
query Admin_UserDetail($author_id: ID!) {
|
||||
query CoralAdmin_UserDetail($author_id: ID!) {
|
||||
user(id: $author_id) {
|
||||
id
|
||||
username
|
||||
|
||||
@@ -15,14 +15,14 @@ const pluginFragments = getSlotsFragments([
|
||||
|
||||
export default withFragments({
|
||||
root: gql`
|
||||
fragment Comment_root on RootQuery {
|
||||
fragment CoralEmbedStream_Comment_root on RootQuery {
|
||||
__typename
|
||||
${pluginFragments.spreads('root')}
|
||||
}
|
||||
${pluginFragments.definitions('root')}
|
||||
`,
|
||||
comment: gql`
|
||||
fragment Comment_comment on Comment {
|
||||
fragment CoralEmbedStream_Comment_comment on Comment {
|
||||
id
|
||||
body
|
||||
created_at
|
||||
|
||||
@@ -60,7 +60,7 @@ class EmbedContainer extends React.Component {
|
||||
}
|
||||
|
||||
const EMBED_QUERY = gql`
|
||||
query EmbedQuery($assetId: ID, $assetUrl: String, $commentId: ID!, $hasComment: Boolean!, $excludeIgnored: Boolean) {
|
||||
query CoralEmbedStream_Embed($assetId: ID, $assetUrl: String, $commentId: ID!, $hasComment: Boolean!, $excludeIgnored: Boolean) {
|
||||
asset(id: $assetId, url: $assetUrl) {
|
||||
totalCommentCount(excludeIgnored: $excludeIgnored)
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class StreamContainer extends React.Component {
|
||||
}
|
||||
|
||||
const LOAD_COMMENT_COUNTS_QUERY = gql`
|
||||
query LoadCommentCounts($assetUrl: String, $assetId: ID, $excludeIgnored: Boolean) {
|
||||
query CoralEmbedStream_LoadCommentCounts($assetUrl: String, $assetId: ID, $excludeIgnored: Boolean) {
|
||||
asset(id: $assetId, url: $assetUrl) {
|
||||
id
|
||||
commentCount(excludeIgnored: $excludeIgnored)
|
||||
@@ -145,7 +145,7 @@ const LOAD_COMMENT_COUNTS_QUERY = gql`
|
||||
`;
|
||||
|
||||
const LOAD_MORE_QUERY = gql`
|
||||
query LoadMoreComments($limit: Int = 5, $cursor: Date, $parent_id: ID, $asset_id: ID, $sort: SORT_ORDER, $excludeIgnored: Boolean) {
|
||||
query CoralEmbedStream_LoadMoreComments($limit: Int = 5, $cursor: Date, $parent_id: ID, $asset_id: ID, $sort: SORT_ORDER, $excludeIgnored: Boolean) {
|
||||
new_top_level_comments: comments(query: {limit: $limit, cursor: $cursor, parent_id: $parent_id, asset_id: $asset_id, sort: $sort, excludeIgnored: $excludeIgnored}) {
|
||||
...${getDefinitionName(Comment.fragments.comment)}
|
||||
replyCount(excludeIgnored: $excludeIgnored)
|
||||
@@ -159,7 +159,7 @@ const LOAD_MORE_QUERY = gql`
|
||||
|
||||
const fragments = {
|
||||
root: gql`
|
||||
fragment Stream_root on RootQuery {
|
||||
fragment CoralEmbedStream_Stream_root on RootQuery {
|
||||
comment(id: $commentId) @include(if: $hasComment) {
|
||||
...${getDefinitionName(Comment.fragments.comment)}
|
||||
replyCount(excludeIgnored: $excludeIgnored)
|
||||
|
||||
@@ -85,7 +85,7 @@ const extension = {
|
||||
mutations: {
|
||||
IgnoreUser: ({variables}) => ({
|
||||
updateQueries: {
|
||||
EmbedQuery: (previousData, {mutationResult}) => {
|
||||
CoralEmbedStream_Embed: (previousData, {mutationResult}) => {
|
||||
const ignoredUserId = variables.id;
|
||||
const response = mutationResult.data.ignoreUser;
|
||||
if (ignoredUserId && !response.errors) {
|
||||
@@ -101,7 +101,7 @@ const extension = {
|
||||
}),
|
||||
StopIgnoringUser: ({variables}) => ({
|
||||
updateQueries: {
|
||||
EmbedStreamProfileQuery: (previousData, {mutationResult}) => {
|
||||
CoralEmbedStream_Profile: (previousData, {mutationResult}) => {
|
||||
const noLongerIgnoredUserId = variables.id;
|
||||
const response = mutationResult.data.stopIgnoringUser;
|
||||
if (noLongerIgnoredUserId && !response.errors) {
|
||||
@@ -141,7 +141,7 @@ const extension = {
|
||||
}
|
||||
},
|
||||
updateQueries: {
|
||||
EmbedQuery: (previousData, {mutationResult: {data: {createComment: {comment}}}}) => {
|
||||
CoralEmbedStream_Embed: (previousData, {mutationResult: {data: {createComment: {comment}}}}) => {
|
||||
if (previousData.asset.settings.moderation === 'PRE' || comment.status === 'PREMOD' || comment.status === 'REJECTED') {
|
||||
return previousData;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ const extension = {
|
||||
variables: {id, edit},
|
||||
}) => ({
|
||||
updateQueries: {
|
||||
EmbedQuery: (previousData, {mutationResult: {data: {editComment: {comment, errors}}}}) => {
|
||||
CoralEmbedStream_Embed: (previousData, {mutationResult: {data: {editComment: {comment, errors}}}}) => {
|
||||
|
||||
// @TODO (kiwi) revisit after streamlining error handling
|
||||
if (errors && errors.length) {
|
||||
|
||||
@@ -84,7 +84,7 @@ class ProfileContainer extends Component {
|
||||
|
||||
const withQuery = graphql(
|
||||
gql`
|
||||
query EmbedStreamProfileQuery {
|
||||
query CoralEmbedStream_Profile {
|
||||
me {
|
||||
id
|
||||
ignoredUsers {
|
||||
|
||||
Reference in New Issue
Block a user