mirror of
https://github.com/wassname/talk.git
synced 2026-08-02 13:10:23 +08:00
Merge branch 'master' into bugs-fix
This commit is contained in:
@@ -50,6 +50,7 @@ sign and verify tokens via a `HS256` algorithm.
|
||||
- `TALK_RECAPTCHA_SECRET` (*required for reCAPTCHA support*) - server secret used for enabling reCAPTCHA powered logins. If not provided it will instead default to providing only a time based lockout.
|
||||
- `TALK_RECAPTCHA_PUBLIC` (*required for reCAPTCHA support*) - client secret used for enabling reCAPTCHA powered logins. If not provided it will instead default to providing only a time based lockout.
|
||||
- `TALK_PLUGINS_JSON` (_optional_) - used to specify the plugin config via the environment
|
||||
- `TALK_KEEP_ALIVE` (_optional_) - The keepalive timeout that should be used to send keep alive messages through the websocket to keep the socket alive. (Default `30s`)
|
||||
|
||||
Refer to the wiki page on [Configuration Loading](https://github.com/coralproject/talk/wiki/Configuration-Loading) for
|
||||
alternative methods of loading configuration during development.
|
||||
|
||||
@@ -129,7 +129,7 @@ class Comment extends React.Component {
|
||||
<div className={styles.moderateArticle}>
|
||||
Story: {comment.asset.title}
|
||||
{!props.currentAsset &&
|
||||
<Link to={`/admin/moderate/${comment.asset.id}`}>{t('modqueue.moderate')}</Link>}
|
||||
<Link to={`/admin/moderate/all/${comment.asset.id}`}>{t('modqueue.moderate')}</Link>}
|
||||
</div>
|
||||
<CSSTransitionGroup
|
||||
component={'div'}
|
||||
|
||||
@@ -81,7 +81,7 @@ const StorySearch = (props) => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.overlay} onClick={props.closeSearch} />
|
||||
<div className={styles.overlay} onClick={props.clearAndCloseSearch} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -89,7 +89,7 @@ const StorySearch = (props) => {
|
||||
StorySearch.propTypes = {
|
||||
search: PropTypes.func.isRequired,
|
||||
goToStory: PropTypes.func.isRequired,
|
||||
closeSearch: PropTypes.func.isRequired,
|
||||
clearAndCloseSearch: PropTypes.func.isRequired,
|
||||
moderation: PropTypes.object.isRequired,
|
||||
handleSearchChange: PropTypes.func.isRequired,
|
||||
assetId: PropTypes.string
|
||||
|
||||
@@ -3,6 +3,7 @@ import {compose, gql} from 'react-apollo';
|
||||
import StorySearch from '../components/StorySearch';
|
||||
import {withRouter} from 'react-router';
|
||||
import withQuery from 'coral-framework/hocs/withQuery';
|
||||
import {isEmpty} from 'lodash';
|
||||
|
||||
class StorySearchContainer extends React.Component {
|
||||
constructor(props) {
|
||||
@@ -13,6 +14,23 @@ class StorySearchContainer extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.props.storySearchChange('');
|
||||
}
|
||||
|
||||
clearSearch = () => {
|
||||
this.setState({searchValue: ''}, () => {
|
||||
this.search();
|
||||
});
|
||||
}
|
||||
|
||||
clearAndCloseSearch = () => {
|
||||
if (!isEmpty(this.state.searchValue)) {
|
||||
this.clearSearch();
|
||||
}
|
||||
this.props.closeSearch();
|
||||
}
|
||||
|
||||
handleSearchChange = (e) => {
|
||||
const {value} = e.target;
|
||||
this.setState({
|
||||
@@ -23,7 +41,7 @@ class StorySearchContainer extends React.Component {
|
||||
handleEsc = (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
e.preventDefault();
|
||||
this.props.closeSearch();
|
||||
this.clearAndCloseSearch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,15 +58,15 @@ class StorySearchContainer extends React.Component {
|
||||
}
|
||||
|
||||
goToStory = (id) => {
|
||||
const {router, closeSearch} = this.props;
|
||||
const {router} = this.props;
|
||||
router.push(`/admin/moderate/all/${id}`);
|
||||
closeSearch();
|
||||
this.clearAndCloseSearch();
|
||||
}
|
||||
|
||||
goToModerateAll = () => {
|
||||
const {router, closeSearch} = this.props;
|
||||
const {router} = this.props;
|
||||
router.push('/admin/moderate/all');
|
||||
closeSearch();
|
||||
this.clearAndCloseSearch();
|
||||
}
|
||||
|
||||
render () {
|
||||
@@ -61,6 +79,7 @@ class StorySearchContainer extends React.Component {
|
||||
handleEnter={this.handleEnter}
|
||||
searchValue={this.state.searchValue}
|
||||
handleSearchChange={this.handleSearchChange}
|
||||
clearAndCloseSearch={this.clearAndCloseSearch}
|
||||
{...this.props}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -56,7 +56,11 @@ const CONFIG = {
|
||||
|
||||
// The URL for this Talk Instance as viewable from the outside.
|
||||
ROOT_URL: process.env.TALK_ROOT_URL,
|
||||
|
||||
|
||||
// The keepalive timeout (in ms) that should be used to send keep alive
|
||||
// messages through the websocket to keep the socket alive.
|
||||
KEEP_ALIVE: process.env.TALK_KEEP_ALIVE || '30s',
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Recaptcha configuration
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -10,6 +10,11 @@ const plugins = require('../services/plugins');
|
||||
|
||||
const {deserializeUser} = require('../services/subscriptions');
|
||||
|
||||
const ms = require('ms');
|
||||
const {
|
||||
KEEP_ALIVE
|
||||
} = require('../config');
|
||||
|
||||
const {
|
||||
SUBSCRIBE_COMMENT_ACCEPTED,
|
||||
SUBSCRIBE_COMMENT_REJECTED,
|
||||
@@ -119,7 +124,8 @@ const createSubscriptionManager = (server) => new SubscriptionServer({
|
||||
};
|
||||
|
||||
return baseParams;
|
||||
}
|
||||
},
|
||||
keepAlive: ms(KEEP_ALIVE)
|
||||
}, {
|
||||
server,
|
||||
path: '/api/v1/live'
|
||||
|
||||
Reference in New Issue
Block a user