Add premodLinks configuration

This commit is contained in:
Chi Vinh Le
2017-11-20 12:36:49 +01:00
parent 8f9724ed90
commit 4c7c3c9e42
2 changed files with 16 additions and 1 deletions
@@ -8,7 +8,7 @@ import Configuration from './Configuration';
class Settings extends React.Component {
render() {
const {settings: {moderation}, toggleModeration} = this.props;
const {settings: {moderation, premodLinksEnable}, toggleModeration, togglePremodLinks} = this.props;
const changed = false;
return (
<div className={styles.wrapper}>
@@ -32,6 +32,13 @@ class Settings extends React.Component {
>
{t('configure.enable_premod_description')}
</Configuration>
<Configuration
checked={premodLinksEnable}
title={t('configure.enable_premod_links')}
onCheckbox={togglePremodLinks}
>
{t('configure.enable_premod_description')}
</Configuration>
</div>
</div>
);
@@ -41,6 +48,7 @@ class Settings extends React.Component {
Settings.propTypes = {
settings: PropTypes.object.isRequired,
toggleModeration: PropTypes.func.isRequired,
togglePremodLinks: PropTypes.func.isRequired,
};
export default Settings;
@@ -17,6 +17,11 @@ class SettingsContainer extends React.Component {
this.props.updatePending({updater});
};
togglePremodLinks = () => {
const updater = {premodLinksEnable: {$set: !this.props.mergedSettings.premodLinksEnable}};
this.props.updatePending({updater});
};
savePending = async () => {
try {
await this.props.updateAssetSettings(this.props.asset.id, this.props.pending);
@@ -32,6 +37,7 @@ class SettingsContainer extends React.Component {
settings={this.props.mergedSettings}
savePending={this.savePending}
toggleModeration={this.toggleModeration}
togglePremodLinks={this.togglePremodLinks}
/>;
}
}
@@ -52,6 +58,7 @@ const withSettingsFragments = withFragments({
id
settings {
moderation
premodLinksEnable
}
}
`,