Fix server rules and custom closed registrations message (#39232)
This commit is contained in:
parent
1dfad49524
commit
ab8f9d94ea
@ -7,7 +7,7 @@ import { fetchServer } from 'mastodon/actions/server';
|
|||||||
import { domain } from 'mastodon/initial_state';
|
import { domain } from 'mastodon/initial_state';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
message: state.getIn(['server', 'server', 'registrations', 'message']),
|
message: state.getIn(['server', 'server', 'item', 'registrations', 'message']),
|
||||||
});
|
});
|
||||||
|
|
||||||
class ClosedRegistrationsModal extends ImmutablePureComponent {
|
class ClosedRegistrationsModal extends ImmutablePureComponent {
|
||||||
|
|||||||
@ -28,14 +28,14 @@ const messages = defineMessages({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
rules: state.getIn(['server', 'server', 'rules'], ImmutableList()),
|
rules: state.getIn(['server', 'server', 'item', 'rules'], []),
|
||||||
});
|
});
|
||||||
|
|
||||||
class Category extends PureComponent {
|
class Category extends PureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
onNextStep: PropTypes.func.isRequired,
|
onNextStep: PropTypes.func.isRequired,
|
||||||
rules: ImmutablePropTypes.list,
|
rules: PropTypes.arrayOf(PropTypes.object),
|
||||||
category: PropTypes.string,
|
category: PropTypes.string,
|
||||||
onChangeCategory: PropTypes.func.isRequired,
|
onChangeCategory: PropTypes.func.isRequired,
|
||||||
startedFrom: PropTypes.oneOf(['status', 'account']),
|
startedFrom: PropTypes.oneOf(['status', 'account']),
|
||||||
@ -69,7 +69,7 @@ class Category extends PureComponent {
|
|||||||
render () {
|
render () {
|
||||||
const { category, startedFrom, rules, intl } = this.props;
|
const { category, startedFrom, rules, intl } = this.props;
|
||||||
|
|
||||||
const options = rules.size > 0 ? [
|
const options = rules.length > 0 ? [
|
||||||
'dislike',
|
'dislike',
|
||||||
'spam',
|
'spam',
|
||||||
'legal',
|
'legal',
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import { Button } from 'mastodon/components/button';
|
|||||||
import Option from './components/option';
|
import Option from './components/option';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
rules: state.getIn(['server', 'server', 'rules']),
|
rules: state.getIn(['server', 'server', 'item', 'rules']),
|
||||||
locale: state.getIn(['meta', 'locale']),
|
locale: state.getIn(['meta', 'locale']),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ class Rules extends PureComponent {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
onNextStep: PropTypes.func.isRequired,
|
onNextStep: PropTypes.func.isRequired,
|
||||||
rules: ImmutablePropTypes.list,
|
rules: PropTypes.arrayOf(PropTypes.object),
|
||||||
locale: PropTypes.string,
|
locale: PropTypes.string,
|
||||||
selectedRuleIds: ImmutablePropTypes.set.isRequired,
|
selectedRuleIds: ImmutablePropTypes.set.isRequired,
|
||||||
onToggle: PropTypes.func.isRequired,
|
onToggle: PropTypes.func.isRequired,
|
||||||
@ -46,12 +46,12 @@ class Rules extends PureComponent {
|
|||||||
<div>
|
<div>
|
||||||
{rules.map(item => (
|
{rules.map(item => (
|
||||||
<Option
|
<Option
|
||||||
key={item.get('id')}
|
key={item.id}
|
||||||
name='rule_ids'
|
name='rule_ids'
|
||||||
value={item.get('id')}
|
value={item.id}
|
||||||
checked={selectedRuleIds.includes(item.get('id'))}
|
checked={selectedRuleIds.includes(item.id)}
|
||||||
onToggle={this.handleRulesToggle}
|
onToggle={this.handleRulesToggle}
|
||||||
label={item.getIn(['translations', locale, 'text']) || item.getIn(['translations', locale.split('-')[0], 'text']) || item.get('text')}
|
label={item.translations?.[locale]?.text || item.translations?.[locale.split('-')[0]]?.text || item.text}
|
||||||
multiple
|
multiple
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user