about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/report/category.js
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-04-28 21:29:29 +0200
committerGitHub <noreply@github.com>2022-04-28 21:29:29 +0200
commiteed5a4bf9c7e41a03ebab92dd45ebc1b899dc768 (patch)
tree65bfea223eae2ac2d6ad4a13fd2967173deeb578 /app/javascript/mastodon/features/report/category.js
parent84d991988eb076a7d83c771b3266f66f1c8a9754 (diff)
Fix empty “Server rules violation” report option (#18165)
Diffstat (limited to 'app/javascript/mastodon/features/report/category.js')
-rw-r--r--app/javascript/mastodon/features/report/category.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/app/javascript/mastodon/features/report/category.js b/app/javascript/mastodon/features/report/category.js
index a36dc81b1..9215b3f51 100644
--- a/app/javascript/mastodon/features/report/category.js
+++ b/app/javascript/mastodon/features/report/category.js
@@ -1,5 +1,7 @@
 import React from 'react';
 import PropTypes from 'prop-types';
+import ImmutablePropTypes from 'react-immutable-proptypes';
+import { connect } from 'react-redux';
 import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
 import Button from 'mastodon/components/button';
 import Option from './components/option';
@@ -17,11 +19,17 @@ const messages = defineMessages({
   account: { id: 'report.category.title_account', defaultMessage: 'profile' },
 });
 
-export default @injectIntl
+const mapStateToProps = state => ({
+  rules: state.get('rules'),
+});
+
+export default @connect(mapStateToProps)
+@injectIntl
 class Category extends React.PureComponent {
 
   static propTypes = {
     onNextStep: PropTypes.func.isRequired,
+    rules: ImmutablePropTypes.list,
     category: PropTypes.string,
     onChangeCategory: PropTypes.func.isRequired,
     startedFrom: PropTypes.oneOf(['status', 'account']),
@@ -53,13 +61,17 @@ class Category extends React.PureComponent {
   };
 
   render () {
-    const { category, startedFrom, intl } = this.props;
+    const { category, startedFrom, rules, intl } = this.props;
 
-    const options = [
+    const options = rules.size > 0 ? [
       'dislike',
       'spam',
       'violation',
       'other',
+    ] : [
+      'dislike',
+      'spam',
+      'other',
     ];
 
     return (