diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index d13729f8f..71fe3723f 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -10,7 +10,6 @@ import React, {PropTypes} from 'react'; import PermalinkButton from 'coral-plugin-permalinks/PermalinkButton'; const Comment = ({comment}) => { - console.log('A Comment', comment); return (

diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index bd056e314..a72d8c1ad 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -2,11 +2,14 @@ import React, {Component, PropTypes} from 'react'; import Pym from 'pym.js'; import {graphql, compose} from 'react-apollo'; import {connect} from 'react-redux'; -import gql from 'graphql-tag'; + +import STREAM_QUERY from './graphql/queries/streamQuery.graphql'; +import POST_COMMENT from './graphql/mutations/postComment.graphql'; import { - itemActions, - Notification, + + // itemActions, + // Notification, notificationActions, authActions } from '../../coral-framework'; @@ -15,14 +18,16 @@ import Stream from './Stream'; import CommentBox from '../../coral-plugin-commentbox/CommentBox'; import InfoBox from '../../coral-plugin-infobox/InfoBox'; -import Content from '../../coral-plugin-commentcontent/CommentContent'; -import PubDate from '../../coral-plugin-pubdate/PubDate'; + +// import Content from '../../coral-plugin-commentcontent/CommentContent'; +// import PubDate from '../../coral-plugin-pubdate/PubDate'; import Count from '../../coral-plugin-comment-count/CommentCount'; -import AuthorName from '../../coral-plugin-author-name/AuthorName'; -import {ReplyBox, ReplyButton} from '../../coral-plugin-replies'; -import FlagComment from '../../coral-plugin-flags/FlagComment'; -import LikeButton from '../../coral-plugin-likes/LikeButton'; -import PermalinkButton from '../../coral-plugin-permalinks/PermalinkButton'; + +// import AuthorName from '../../coral-plugin-author-name/AuthorName'; +// import {ReplyBox, ReplyButton} from '../../coral-plugin-replies'; +// import FlagComment from '../../coral-plugin-flags/FlagComment'; +// import LikeButton from '../../coral-plugin-likes/LikeButton'; +// import PermalinkButton from '../../coral-plugin-permalinks/PermalinkButton'; import SignInContainer from '../../coral-sign-in/containers/SignInContainer'; import UserBox from '../../coral-sign-in/components/UserBox'; @@ -63,35 +68,32 @@ class Embed extends Component { } componentDidMount () { + // stream id, logged in user, settings - return; // Set up messaging between embedded Iframe an parent component - if (!path) { - path = window.location.href.split('#')[0]; - } // this.props.getStream(path || window.location); - this.path = path; - - this.pym.sendMessage('childReady'); - - this.pym.onMessage('DOMContentLoaded', hash => { - const commentId = hash.replace('#', 'c_'); - let count = 0; - const interval = setInterval(() => { - if (document.getElementById(commentId)) { - window.clearInterval(interval); - this.pym.scrollParentToChildEl(commentId); - } - - if (++count > 100) { // ~10 seconds - // give up waiting for the comments to load. - // it would be weird for the page to jump after that long. - window.clearInterval(interval); - } - }, 100); - }); + // this.path = window.location.href.split('#')[0]; + // + // this.pym.sendMessage('childReady'); + // + // this.pym.onMessage('DOMContentLoaded', hash => { + // const commentId = hash.replace('#', 'c_'); + // let count = 0; + // const interval = setInterval(() => { + // if (document.getElementById(commentId)) { + // window.clearInterval(interval); + // this.pym.scrollParentToChildEl(commentId); + // } + // + // if (++count > 100) { // ~10 seconds + // // give up waiting for the comments to load. + // // it would be weird for the page to jump after that long. + // window.clearInterval(interval); + // } + // }, 100); + // }); } render () { @@ -154,11 +156,11 @@ class Embed extends Component { showSignInDialog={showSignInDialog}/> } - {/**/} + {/* */} - {/**/} + {/* */}
} ; @@ -188,7 +190,8 @@ class Embed extends Component { const mapStateToProps = state => (state); -const mapDispatchToProps = (dispatch, ownProps) => ({ +const mapDispatchToProps = dispatch => ({ + // addItem: (item, item_id) => dispatch(addItem(item, item_id)), // updateItem: (id, property, value, itemType) => dispatch(updateItem(id, property, value, itemType)), // postItem: (data, type, id) => { @@ -198,8 +201,10 @@ const mapDispatchToProps = (dispatch, ownProps) => ({ // getStream: (rootId) => dispatch(getStream(rootId)), addNotification: (type, text) => dispatch(addNotification(type, text)), clearNotification: () => dispatch(clearNotification()), + // postAction: (item, itemType, action) => dispatch(postAction(item, itemType, action)), showSignInDialog: (offset) => dispatch(showSignInDialog(offset)), + // deleteAction: (item, action, user, itemType) => dispatch(deleteAction(item, action, user, itemType)), // appendItemArray: (item, property, value, addToFront, itemType) => dispatch(appendItemArray(item, property, value, addToFront, itemType)), // handleSignInDialog: () => dispatch(authActions.showSignInDialog()), @@ -211,18 +216,14 @@ const pym = new Pym.Child({polling: 100}); let url = pym.parentUrl; -import STREAM_QUERY from './graphql/queries/streamQuery.graphql'; -import POST_COMMENT from './graphql/mutations/postComment.graphql'; - -console.log(STREAM_QUERY, POST_COMMENT) export default compose( graphql(STREAM_QUERY, { - options: { variables: { asset_url: url } }, + options: {variables: {asset_url: url}}, props: props => props, }), graphql(POST_COMMENT, { - props: ({ownProps, mutate}) => ({ - postItem: ({asset_id, author_id, body}) => { + props: ({mutate}) => ({ + postItem: ({asset_id, body}) => { mutate({ variables: { asset_id, @@ -233,7 +234,7 @@ export default compose( console.log('it workt'); console.log(data); }); - }}), + }}), }), connect(mapStateToProps, mapDispatchToProps) )(Embed); diff --git a/client/coral-embed-stream/src/Stream.js b/client/coral-embed-stream/src/Stream.js index 13dbaf35d..61cfcd29d 100644 --- a/client/coral-embed-stream/src/Stream.js +++ b/client/coral-embed-stream/src/Stream.js @@ -1,4 +1,4 @@ -import React, {Component, PropTypes} from 'react'; +import React, {PropTypes} from 'react'; import Comment from './Comment'; const Stream = ({comments}) => { diff --git a/client/coral-framework/actions/items.js b/client/coral-framework/actions/items.js index 78e3f64b7..e289e9f60 100644 --- a/client/coral-framework/actions/items.js +++ b/client/coral-framework/actions/items.js @@ -2,8 +2,6 @@ import coralApi from '../helpers/response'; import {fromJS} from 'immutable'; import {UPDATE_CONFIG} from '../constants/config'; -import gql from 'graphql-tag'; - /** * Action name constants */ @@ -191,22 +189,13 @@ export function getItemsArray (ids) { * The newly put item to the item store */ - -const postComment = gql` - mutation CreateComment ($asset_id: ID!, $parent_id: ID, $body: String!) { - createComment(asset_id:$asset_id, parent_id:$parent_id, body:$body) { - ...commentView - } - } -`; - export function postItem (item, type, id, mutate) { console.log( item, type, id, mutate - ) + ); mutate({ variables: { asset_id: id, diff --git a/client/coral-framework/reducers/index.js b/client/coral-framework/reducers/index.js index e406a5524..2c862ebbd 100644 --- a/client/coral-framework/reducers/index.js +++ b/client/coral-framework/reducers/index.js @@ -1,4 +1,3 @@ -import {combineReducers} from 'redux'; import config from './config'; import items from './items'; import notification from './notification'; diff --git a/graph/mutators.js b/graph/mutators.js index f5c600499..298a51404 100644 --- a/graph/mutators.js +++ b/graph/mutators.js @@ -118,7 +118,7 @@ const createPublicComment = (context, commentInput) => { // If the comment was flagged as being suspect, we need to add a // flag to it to indicate that it needs to be looked at. // Otherwise just return the new comment. - if (wordlist != null && wordlist.suspect) { + if (wordlist !== null && wordlist.suspect) { // TODO: this is kind of fragile, we should refactor this to resolve // all these const's that we're using like 'comments', 'flag' to be