Admin: fetch ConfigDB config, start RegistrationModePicker
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { connect } from 'react-redux';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import {
|
||||
SimpleForm,
|
||||
FieldsGroup,
|
||||
RadioGroup,
|
||||
RadioItem,
|
||||
} from 'soapbox/features/forms';
|
||||
|
||||
const mapStateToProps = (state, props) => ({
|
||||
instance: state.get('instance'),
|
||||
openReportCount: state.getIn(['admin', 'open_report_count']),
|
||||
});
|
||||
|
||||
export default @connect(mapStateToProps)
|
||||
class RegistrationModePicker extends ImmutablePureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<SimpleForm>
|
||||
<FieldsGroup>
|
||||
<RadioGroup
|
||||
label={<FormattedMessage id='admin.dashboard.registration_mode_label' defaultMessage='Registrations' />}
|
||||
checked
|
||||
onChange={this.onChange}
|
||||
>
|
||||
<RadioItem
|
||||
label={<FormattedMessage id='admin.dashboard.registration_mode.open_label' defaultMessage='Open' />}
|
||||
hint={<FormattedMessage id='admin.dashboard.registration_mode.open_hint' defaultMessage='Anyone can join.' />}
|
||||
value='open'
|
||||
/>
|
||||
<RadioItem
|
||||
label={<FormattedMessage id='admin.dashboard.registration_mode.approval_label' defaultMessage='Approval Required' />}
|
||||
hint={<FormattedMessage id='admin.dashboard.registration_mode.approval_hint' defaultMessage='Users can sign up, but their account only gets activated when an admin approves it.' />}
|
||||
value='approval'
|
||||
/>
|
||||
<RadioItem
|
||||
label={<FormattedMessage id='admin.dashboard.registration_mode.closed_label' defaultMessage='Closed' />}
|
||||
hint={<FormattedMessage id='admin.dashboard.registration_mode.closed_hint' defaultMessage='Nobody can sign up. You can still invite people.' />}
|
||||
value='closed'
|
||||
/>
|
||||
</RadioGroup>
|
||||
</FieldsGroup>
|
||||
</SimpleForm>
|
||||
);
|
||||
};
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import Column from '../ui/components/column';
|
||||
import RegistrationModePicker from './components/registration_mode_picker';
|
||||
import { parseVersion } from 'soapbox/utils/features';
|
||||
|
||||
const messages = defineMessages({
|
||||
@@ -63,8 +64,8 @@ class Dashboard extends ImmutablePureComponent {
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{/* TODO: Awaiting approval users count */}
|
||||
</div>
|
||||
<RegistrationModePicker />
|
||||
<div className='dashwidgets'>
|
||||
<div class='dashwidget'>
|
||||
<h4><FormattedMessage id='admin.dashwidgets.software_header' defaultMessage='Software' /></h4>
|
||||
|
||||
@@ -16,7 +16,7 @@ import { debounce } from 'lodash';
|
||||
import { uploadCompose, resetCompose } from '../../actions/compose';
|
||||
import { expandHomeTimeline } from '../../actions/timelines';
|
||||
import { expandNotifications } from '../../actions/notifications';
|
||||
import { fetchReports, fetchUsers } from '../../actions/admin';
|
||||
import { fetchReports, fetchUsers, fetchConfig } from '../../actions/admin';
|
||||
import { fetchFilters } from '../../actions/filters';
|
||||
import { fetchChats } from 'soapbox/actions/chats';
|
||||
import { clearHeight } from '../../actions/height_cache';
|
||||
@@ -465,6 +465,7 @@ class UI extends React.PureComponent {
|
||||
if (isStaff(account)) {
|
||||
this.props.dispatch(fetchReports({ state: 'open' }));
|
||||
this.props.dispatch(fetchUsers({ page: 1, filters: 'local,need_approval' }));
|
||||
this.props.dispatch(fetchConfig());
|
||||
}
|
||||
|
||||
setTimeout(() => this.props.dispatch(fetchFilters()), 500);
|
||||
|
||||
Reference in New Issue
Block a user