mirror of
https://github.com/wassname/talk.git
synced 2026-07-09 12:35:55 +08:00
merge
This commit is contained in:
+13
-3
@@ -5,11 +5,21 @@ machine:
|
||||
- docker
|
||||
- redis
|
||||
|
||||
dependencies:
|
||||
post:
|
||||
# Lint the project here, before tests are ran.
|
||||
- npm run lint
|
||||
|
||||
database:
|
||||
post:
|
||||
# Initialize the settings in the database, this will create indicies for the
|
||||
# database.
|
||||
- ./bin/cli settings init
|
||||
- sleep 2
|
||||
|
||||
test:
|
||||
override:
|
||||
- npm run lint
|
||||
- ./bin/cli settings init
|
||||
- sleep 5
|
||||
# Run the tests using the junit reporter.
|
||||
- MOCHA_FILE=$CIRCLE_TEST_REPORTS/junit/test-results.xml NPM_PACKAGE_CONFIG_MOCHA_REPORTER=mocha-junit-reporter npm run test
|
||||
|
||||
deployment:
|
||||
|
||||
@@ -9,10 +9,9 @@ const {logout, showSignInDialog} = authActions;
|
||||
const {addNotification, clearNotification} = notificationActions;
|
||||
const {fetchAssetSuccess} = assetActions;
|
||||
|
||||
import pym from './PymConnection';
|
||||
import {queryStream} from './graphql/queries';
|
||||
import {postComment, postAction, deleteAction} from './graphql/mutations';
|
||||
import {Notification, notificationActions, authActions, assetActions} from 'coral-framework';
|
||||
import {Notification, notificationActions, authActions, assetActions, pym} from 'coral-framework';
|
||||
|
||||
import Stream from './Stream';
|
||||
import InfoBox from 'coral-plugin-infobox/InfoBox';
|
||||
@@ -95,7 +94,7 @@ class Embed extends Component {
|
||||
const {loggedIn, isAdmin, user, showSignInDialog, signInOffset} = this.props.auth;
|
||||
|
||||
const expandForLogin = showSignInDialog ? {
|
||||
minHeight: document.body.scrollHeight + 150
|
||||
minHeight: document.body.scrollHeight + 200
|
||||
} : {};
|
||||
|
||||
return <div style={expandForLogin}>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import Pym from '../../../node_modules/pym.js';
|
||||
|
||||
export default new Pym.Child({polling: 100});
|
||||
@@ -1,6 +1,6 @@
|
||||
import {graphql} from 'react-apollo';
|
||||
import STREAM_QUERY from './streamQuery.graphql';
|
||||
import pym from '../../PymConnection';
|
||||
import pym from 'coral-framework/PymConnection';
|
||||
|
||||
let url = pym.parentUrl.split('#')[0] || 'http://localhost:3000/';
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import Pym from '../../node_modules/pym.js';
|
||||
|
||||
const pym = new Pym.Child({polling: 100});
|
||||
export default pym;
|
||||
|
||||
export const link = (url) => (e) => {
|
||||
e.preventDefault();
|
||||
pym.sendMessage('navigate', url);
|
||||
};
|
||||
@@ -5,6 +5,7 @@ import I18n from './modules/i18n/i18n';
|
||||
import * as notificationActions from './actions/notification';
|
||||
import * as authActions from './actions/auth';
|
||||
import * as assetActions from './actions/asset';
|
||||
import pym from './PymConnection';
|
||||
|
||||
export {
|
||||
Notification,
|
||||
@@ -13,5 +14,7 @@ export {
|
||||
I18n,
|
||||
notificationActions,
|
||||
authActions,
|
||||
assetActions
|
||||
configActions,
|
||||
assetActions,
|
||||
pym
|
||||
};
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import React, {PropTypes} from 'react';
|
||||
|
||||
import styles from './Comment.css';
|
||||
|
||||
const Comment = props => {
|
||||
return (
|
||||
<div className={styles.myComment}>
|
||||
<p className="myCommentAsset">
|
||||
<a className={`${styles.assetURL} myCommentAnchor`} href={`${props.asset.url}#${props.comment.id}`}>{props.asset.url}</a>
|
||||
<a className={`${styles.assetURL} myCommentAnchor`} href='#' onClick={props.link(`${props.asset.url}#${props.comment.id}`)}>{props.asset.url}</a>
|
||||
</p>
|
||||
<p className={`${styles.commentBody} myCommentBody`}>{props.comment.body}</p>
|
||||
</div>
|
||||
|
||||
@@ -11,6 +11,7 @@ const CommentHistory = props => {
|
||||
return <Comment
|
||||
key={i}
|
||||
comment={comment}
|
||||
link={props.link}
|
||||
asset={asset} />;
|
||||
})}
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ import {connect} from 'react-redux';
|
||||
|
||||
import {saveBio, fetchCommentsByUserId} from 'coral-framework/actions/user';
|
||||
|
||||
import {link} from 'coral-framework/PymConnection';
|
||||
import BioContainer from './BioContainer';
|
||||
import NotLoggedIn from '../components/NotLoggedIn';
|
||||
import {TabBar, Tab, TabContent} from '../../coral-ui';
|
||||
@@ -62,6 +63,7 @@ class SettingsContainer extends Component {
|
||||
user.myComments.length && user.myAssets.length
|
||||
? <CommentHistory
|
||||
comments={commentsMostRecentFirst}
|
||||
link={link}
|
||||
assets={user.myAssets.map(id => items.assets[id])} />
|
||||
: <p>{lang.t('user-no-comment')}</p>
|
||||
}
|
||||
|
||||
@@ -9,20 +9,19 @@ describe('coral-plugin-history/Comment', () => {
|
||||
const asset = {url: 'https://google.com'};
|
||||
|
||||
beforeEach(() => {
|
||||
render = shallow(<Comment asset={asset} comment={comment} />);
|
||||
render = shallow(<Comment asset={asset} comment={comment} link={()=>{}}/>);
|
||||
});
|
||||
|
||||
it('should render the provided comment body', () => {
|
||||
const wrapper = mount(<Comment asset={asset} comment={comment} />);
|
||||
const wrapper = mount(<Comment asset={asset} comment={comment} link={()=>{}}/>);
|
||||
expect(wrapper.find('.myCommentBody')).to.have.length(1);
|
||||
expect(wrapper.find('.myCommentBody').text()).to.equal('this is a comment');
|
||||
});
|
||||
|
||||
it('should render the asset url as a link', () => {
|
||||
const wrapper = mount(<Comment asset={asset} comment={comment} />);
|
||||
const wrapper = mount(<Comment asset={asset} comment={comment} link={()=>{}}/>);
|
||||
expect(wrapper.find('.myCommentAnchor')).to.have.length(1);
|
||||
expect(wrapper.find('.myCommentAnchor').text()).to.equal('https://google.com');
|
||||
expect(wrapper.find('.myCommentAnchor').props().href).to.equal('https://google.com#123');
|
||||
});
|
||||
|
||||
it('should render the comment with styles', () => {
|
||||
|
||||
@@ -9,11 +9,11 @@ describe('coral-plugin-history/CommentHistory', () => {
|
||||
const assets = [{'settings': null, 'created_at':'2016-12-06T21:36:09.302Z', 'url':'localhost:3000/', 'scraped':null, 'status':'open', 'updated_at':'2016-12-08T02:11:15.943Z', '_id':'58472f499e775a38f23d5da0', 'type':'article', 'closedMessage':null, 'id':'7302e637-f884-47c0-9723-02cc10a18617', 'closedAt':null}, {'settings':null, 'created_at':'2016-12-07T02:25:31.983Z', 'url':'http://localhost:3000/', 'scraped':null, 'status':'open', 'updated_at':'2016-12-13T22:58:36.061Z', '_id':'5847731b9e775a38f23d5da1', 'type':'article', 'closedMessage':null, 'id':'96fddf96-7c83-4008-80ad-50091997d006', 'closedAt':null}, {'settings':null, 'created_at':'2016-12-12T19:04:05.770Z', 'url':'http://localhost:3000/embed/stream', 'scraped':null, 'updated_at':'2016-12-14T20:13:21.934Z', '_id':'584ef4a59e775a38f23d5e86', 'type':'article', 'closedMessage':null, 'id':'cef81015-1b53-4d70-b9af-6eca680f22fc', 'closedAt':null}];
|
||||
|
||||
beforeEach(() => {
|
||||
render = shallow(<CommentHistory comments={comments} assets={assets} />);
|
||||
render = shallow(<CommentHistory comments={comments} assets={assets} link={()=>{}}/>);
|
||||
});
|
||||
|
||||
it('should render Comments as children when given comments and assets', () => {
|
||||
const wrapper = mount(<CommentHistory comments={comments} assets={assets} />);
|
||||
const wrapper = mount(<CommentHistory comments={comments} assets={assets} link={()=>{}}/>);
|
||||
expect(wrapper.find('.commentHistory__list').children()).to.have.length(7);
|
||||
});
|
||||
|
||||
@@ -21,4 +21,3 @@ describe('coral-plugin-history/CommentHistory', () => {
|
||||
expect(render.props().style).to.be.defined;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -46,6 +46,9 @@
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
pymParent.onMessage('navigate', function (url) {
|
||||
window.open(url, '_blank').focus();
|
||||
})
|
||||
|
||||
// wait till images and other iframes are loaded before scrolling the page.
|
||||
// or do we want to be more aggressive and scroll when we hit DOM ready?
|
||||
|
||||
@@ -31,7 +31,11 @@
|
||||
pymParent.sendMessage('DOMContentLoaded', window.location.hash);
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
pymParent.onMessage('navigate', function (url) {
|
||||
window.open(url, '_blank').focus();
|
||||
})
|
||||
);
|
||||
|
||||
// wait till images and other iframes are loaded before scrolling the page.
|
||||
// or do we want to be more aggressive and scroll when we hit DOM ready?
|
||||
|
||||
Reference in New Issue
Block a user