From 06001763fffb31a6fbdb7a54ab08483eced72e06 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 16 May 2017 00:52:37 +0700 Subject: [PATCH] Remove unused files --- .../graphql/mutations/index.js | 191 ------------------ .../graphql/queries/myIgnoredUsers.graphql | 8 - 2 files changed, 199 deletions(-) delete mode 100644 client/coral-framework/graphql/mutations/index.js delete mode 100644 client/coral-framework/graphql/queries/myIgnoredUsers.graphql diff --git a/client/coral-framework/graphql/mutations/index.js b/client/coral-framework/graphql/mutations/index.js deleted file mode 100644 index 0249bbe4e..000000000 --- a/client/coral-framework/graphql/mutations/index.js +++ /dev/null @@ -1,191 +0,0 @@ -import {graphql} from 'react-apollo'; -import POST_COMMENT from './postComment.graphql'; -import POST_FLAG from './postFlag.graphql'; -import POST_DONT_AGREE from './postDontAgree.graphql'; -import DELETE_ACTION from './deleteAction.graphql'; -import ADD_COMMENT_TAG from './addCommentTag.graphql'; -import REMOVE_COMMENT_TAG from './removeCommentTag.graphql'; -import IGNORE_USER from './ignoreUser.graphql'; -import STOP_IGNORING_USER from './stopIgnoringUser.graphql'; -import EDIT_COMMENT from './editComment.graphql'; - -import commentView from '../fragments/commentView.graphql'; - -export const postComment = graphql(POST_COMMENT, { - options: () => ({ - fragments: commentView - }), - props: ({ownProps, mutate}) => ({ - postItem: (comment) => { - const {asset_id, body, parent_id, tags = []} = comment; - return mutate({ - variables: { - comment - }, - optimisticResponse: { - createComment: { - comment: { - user: { - id: ownProps.auth.user.id, - name: ownProps.auth.user.username - }, - created_at: new Date().toISOString(), - body, - parent_id, - asset_id, - action_summaries: [], - tags, - status: null, - id: 'pending' - } - } - }, - updateQueries: { - EmbedQuery: (oldData, {mutationResult: {data: {createComment: {comment}}}}) => { - - if (oldData.asset.settings.moderation === 'PRE' || comment.status === 'PREMOD' || comment.status === 'REJECTED') { - return oldData; - } - - let updatedAsset; - - // If posting a reply - if (parent_id) { - updatedAsset = { - ...oldData, - asset: { - ...oldData.asset, - comments: oldData.asset.comments.map((oldComment) => { - return oldComment.id === parent_id - ? {...oldComment, replies: [...oldComment.replies, comment], replyCount: oldComment.replyCount + 1} - : oldComment; - }) - } - }; - } else { - - // If posting a top-level comment - updatedAsset = { - ...oldData, - asset: { - ...oldData.asset, - commentCount: oldData.asset.commentCount + 1, - comments: [comment, ...oldData.asset.comments] - } - }; - } - - return updatedAsset; - } - } - }); - } - }), -}); - -export const postFlag = graphql(POST_FLAG, { - props: ({mutate}) => ({ - postFlag: (flag) => { - return mutate({ - variables: { - flag - } - }); - }}), -}); - -export const postDontAgree = graphql(POST_DONT_AGREE, { - props: ({mutate}) => ({ - postDontAgree: (dontagree) => { - return mutate({ - variables: { - dontagree - } - }); - }}), -}); - -export const deleteAction = graphql(DELETE_ACTION, { - props: ({mutate}) => ({ - deleteAction: (id) => { - return mutate({ - variables: { - id - } - }); - }}), -}); - -export const addCommentTag = graphql(ADD_COMMENT_TAG, { - props: ({mutate}) => ({ - addCommentTag: ({id, tag}) => { - return mutate({ - variables: { - id, - tag - } - }); - }}), -}); - -export const removeCommentTag = graphql(REMOVE_COMMENT_TAG, { - props: ({mutate}) => ({ - removeCommentTag: ({id, tag}) => { - return mutate({ - variables: { - id, - tag - } - }); - }}), -}); - -// TODO: don't rely on refetching. -export const ignoreUser = graphql(IGNORE_USER, { - props: ({mutate}) => ({ - ignoreUser: ({id}) => { - return mutate({ - variables: { - id, - }, - refetchQueries: [ - 'EmbedQuery', 'myIgnoredUsers', - ] - }); - }}), -}); - -// TODO: don't rely on refetching. -export const stopIgnoringUser = graphql(STOP_IGNORING_USER, { - props: ({mutate}) => { - return { - stopIgnoringUser: ({id}) => { - return mutate({ - variables: { - id, - }, - refetchQueries: [ - 'EmbedQuery', 'myIgnoredUsers', - ] - }); - } - }; - } -}); - -export const editComment = graphql(EDIT_COMMENT, { - props: ({mutate}) => { - return { - editComment: (id, asset_id, edit) => { - return mutate({ - variables: { - id, - asset_id, - edit, - }, - refetchQueries: [] - }); - } - }; - } -}); diff --git a/client/coral-framework/graphql/queries/myIgnoredUsers.graphql b/client/coral-framework/graphql/queries/myIgnoredUsers.graphql deleted file mode 100644 index 4bdd7fcdd..000000000 --- a/client/coral-framework/graphql/queries/myIgnoredUsers.graphql +++ /dev/null @@ -1,8 +0,0 @@ -query myIgnoredUsers { - me { - ignoredUsers { - id, - username, - } - } -}