mirror of
https://github.com/wassname/talk.git
synced 2026-08-16 11:29:31 +08:00
Merge branch 'master' of github.com:coralproject/talk into wordlist
This commit is contained in:
@@ -26,11 +26,16 @@ const updateInfoBoxContent = (props) => (event) => {
|
||||
props.updateSettings({infoBoxContent});
|
||||
};
|
||||
|
||||
const StateLess = (props) => <List>
|
||||
const updateClosedMessage = (props) => (event) => {
|
||||
const closedMessage = event.target.value;
|
||||
props.updateSettings({closedMessage});
|
||||
};
|
||||
|
||||
const CommentSettings = (props) => <List>
|
||||
<ListItem className={styles.configSetting}>
|
||||
<ListItemAction>
|
||||
<Checkbox
|
||||
onClick={updateModeration(props)}
|
||||
onClick={updateModeration}
|
||||
checked={props.settings.moderation === 'pre'} />
|
||||
</ListItemAction>
|
||||
{lang.t('configure.enable-pre-moderation')}
|
||||
@@ -38,7 +43,7 @@ const StateLess = (props) => <List>
|
||||
<ListItem threeLine className={styles.configSettingInfoBox}>
|
||||
<ListItemAction>
|
||||
<Checkbox
|
||||
onClick={updateInfoBoxEnable(props)}
|
||||
onClick={updateInfoBoxEnable}
|
||||
checked={props.settings.infoBoxEnable} />
|
||||
</ListItemAction>
|
||||
<ListItemContent>
|
||||
@@ -48,10 +53,20 @@ const StateLess = (props) => <List>
|
||||
</p>
|
||||
</ListItemContent>
|
||||
</ListItem>
|
||||
<ListItem className={`${styles.configSettingInfoBox} ${props.settings.infoBoxEnable ? null : styles.hidden}`} >
|
||||
<ListItem className={styles.configSettingInfoBox}>
|
||||
<ListItemContent>
|
||||
{lang.t('configure.closed-comments-desc')}
|
||||
<Textfield
|
||||
onChange={updateClosedMessage}
|
||||
value={props.settings.closedMessage}
|
||||
label={lang.t('configure.closed-comments-label')}
|
||||
rows={3}/>
|
||||
</ListItemContent>
|
||||
</ListItem>
|
||||
<ListItem className={`${styles.configSettingInfoBox} ${this.props.settings.infoBoxEnable ? null : styles.hidden}`} >
|
||||
<ListItemContent>
|
||||
<Textfield
|
||||
onChange={updateInfoBoxContent(props)}
|
||||
onChange={updateInfoBoxContent}
|
||||
value={props.settings.infoBoxContent}
|
||||
label={lang.t('configure.include-text')}
|
||||
rows={3}/>
|
||||
@@ -59,6 +74,6 @@ const StateLess = (props) => <List>
|
||||
</ListItem>
|
||||
</List>;
|
||||
|
||||
export default StateLess;
|
||||
export default CommentSettings;
|
||||
|
||||
const lang = new I18n(translations);
|
||||
|
||||
@@ -18,21 +18,19 @@ import Wordlist from './Wordlist';
|
||||
class Configure extends React.Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
activeSection: 'comments',
|
||||
wordlist: [],
|
||||
changed: false
|
||||
};
|
||||
this.saveSettings = this.saveSettings.bind(this);
|
||||
this.onChangeWordlist = this.onChangeWordlist.bind(this);
|
||||
this.onSettingUpdate = this.onSettingUpdate.bind(this);
|
||||
}
|
||||
|
||||
componentWillMount () {
|
||||
componentWillMount = () => {
|
||||
this.props.dispatch(fetchSettings());
|
||||
}
|
||||
|
||||
componentWillUpdate (newProps) {
|
||||
componentWillUpdate = (newProps) => {
|
||||
if ((!this.props.settings
|
||||
|| !this.props.settings.wordlist)
|
||||
&& newProps.settings.wordlist
|
||||
@@ -41,16 +39,16 @@ class Configure extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
saveSettings () {
|
||||
saveSettings = () => {
|
||||
this.props.dispatch(saveSettingsToServer());
|
||||
this.setState({changed: false});
|
||||
}
|
||||
|
||||
changeSection (activeSection) {
|
||||
changeSection = (activeSection) => () => {
|
||||
this.setState({activeSection});
|
||||
}
|
||||
|
||||
onChangeWordlist (event) {
|
||||
onChangeWordlist = (event) => {
|
||||
event.preventDefault();
|
||||
const newlist = event.target.value;
|
||||
this.setState({wordlist: newlist.toLowerCase(), changed: true});
|
||||
@@ -61,12 +59,12 @@ class Configure extends React.Component {
|
||||
}));
|
||||
}
|
||||
|
||||
onSettingUpdate (setting) {
|
||||
onSettingUpdate = (setting) => {
|
||||
this.setState({changed: true});
|
||||
this.props.dispatch(updateSettings(setting));
|
||||
}
|
||||
|
||||
getSection (section) {
|
||||
getSection = (section) => {
|
||||
switch(section){
|
||||
case 'comments':
|
||||
return <CommentSettings
|
||||
@@ -81,7 +79,7 @@ class Configure extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
getPageTitle (section) {
|
||||
getPageTitle = (section) => {
|
||||
switch(section) {
|
||||
case 'comments':
|
||||
return lang.t('configure.comment-settings');
|
||||
@@ -106,17 +104,17 @@ class Configure extends React.Component {
|
||||
<List>
|
||||
<ListItem className={styles.settingOption}>
|
||||
<ListItemContent
|
||||
onClick={this.changeSection.bind(this, 'comments')}
|
||||
onClick={this.changeSection('comments')}
|
||||
icon='settings'>{lang.t('configure.comment-settings')}</ListItemContent>
|
||||
</ListItem>
|
||||
<ListItem className={styles.settingOption}>
|
||||
<ListItemContent
|
||||
onClick={this.changeSection.bind(this, 'embed')}
|
||||
onClick={this.changeSection('embed')}
|
||||
icon='code'>{lang.t('configure.embed-comment-stream')}</ListItemContent>
|
||||
</ListItem>
|
||||
<ListItem className={styles.settingOption}>
|
||||
<ListItemContent
|
||||
onClick={this.changeSection.bind(this, 'wordlist')}
|
||||
onClick={this.changeSection('wordlist')}
|
||||
icon='settings'>{lang.t('configure.wordlist')}</ListItemContent>
|
||||
</ListItem>
|
||||
</List>
|
||||
|
||||
@@ -81,9 +81,11 @@ class ModerationQueue extends React.Component {
|
||||
singleView={singleView}
|
||||
commentIds={
|
||||
comments.get('ids')
|
||||
.filter(id => !comments.get('byId')
|
||||
.filter(id =>
|
||||
comments
|
||||
.get('byId')
|
||||
.get(id)
|
||||
.get('status'))
|
||||
.get('status') === 'premod')
|
||||
}
|
||||
comments={comments.get('byId')}
|
||||
users={users.get('byId')}
|
||||
|
||||
@@ -44,7 +44,9 @@
|
||||
"copy-and-paste": "Copy and paste code below into your CMS to embed your comment box in your articles",
|
||||
"moderate": "Moderate",
|
||||
"configure": "Configure",
|
||||
"community": "Community"
|
||||
"community": "Community",
|
||||
"closed-comments-desc": "Write a message for closed threads",
|
||||
"closed-comments-label": "Write a message..."
|
||||
}
|
||||
},
|
||||
"es": {
|
||||
@@ -81,7 +83,9 @@
|
||||
"copy-and-paste": "Copiar y pegar el código de más abajo en tu CMS para colocar la caja de comentarios en tus articulos",
|
||||
"moderate": "Moderar",
|
||||
"configure": "Configurar",
|
||||
"community": "Comunidad"
|
||||
"community": "Comunidad",
|
||||
"closed-comments-desc": "Escribe un mensaje para cuando los comentarios se encuentran cerrados",
|
||||
"closed-comments-label": "Escribe un mensaje..."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class CommentStream extends Component {
|
||||
const rootItem = this.props.items.assets && this.props.items.assets[rootItemId];
|
||||
const {actions, users, comments} = this.props.items;
|
||||
const {loggedIn, user, showSignInDialog, signInOffset} = this.props.auth;
|
||||
const {status} = this.props.config;
|
||||
const {status, closedMessage} = this.props.config;
|
||||
const {activeTab} = this.state;
|
||||
const expandForLogin = showSignInDialog ? {
|
||||
minHeight: document.body.scrollHeight + 150
|
||||
@@ -133,7 +133,7 @@ class CommentStream extends Component {
|
||||
author={user}
|
||||
/>
|
||||
</div>
|
||||
: <p>Comments are closed for this thread.</p>
|
||||
: <p>{closedMessage}</p>
|
||||
}
|
||||
{!loggedIn && <SignInContainer offset={signInOffset} />}
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ import coralApi from '../helpers/response';
|
||||
* Action name constants
|
||||
*/
|
||||
|
||||
export const UPDATE_SETTINGS = 'UPDATE_SETTINGS';
|
||||
export const OPEN_COMMENTS = 'OPEN_COMMENTS';
|
||||
export const CLOSE_COMMENTS = 'CLOSE_COMMENTS';
|
||||
export const ADD_ITEM = 'ADD_ITEM';
|
||||
|
||||
@@ -5,7 +5,8 @@ import * as actions from '../actions/config';
|
||||
|
||||
const initialState = Map({
|
||||
features: Map({}),
|
||||
status: 'open'
|
||||
status: 'open',
|
||||
closedMessage: ''
|
||||
});
|
||||
|
||||
export default (state = initialState, action) => {
|
||||
|
||||
Reference in New Issue
Block a user