about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-02-27 07:37:00 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-03-01 10:01:06 +0100
commitc0a8fb2b59665bd1c3d0ce6b94d451f779fab4b6 (patch)
tree7b46d3725dee6208409dd8e0d53fe79cca8d51b5
parentc5925756f13398f42fb1a59f8504050d195888a8 (diff)
[Glitch] Fix report submit button not being disabled during submission in web UI
Port 0883f057531d291e8793bd3113f4331c502ad8cf to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
-rw-r--r--app/javascript/flavours/glitch/features/report/comment.js2
-rw-r--r--app/javascript/flavours/glitch/features/report/statuses.js7
2 files changed, 6 insertions, 3 deletions
diff --git a/app/javascript/flavours/glitch/features/report/comment.js b/app/javascript/flavours/glitch/features/report/comment.js
index b2663bbf2..ec261afcb 100644
--- a/app/javascript/flavours/glitch/features/report/comment.js
+++ b/app/javascript/flavours/glitch/features/report/comment.js
@@ -74,7 +74,7 @@ class Comment extends React.PureComponent {
         <div className='flex-spacer' />
 
         <div className='report-dialog-modal__actions'>
-          <Button onClick={this.handleClick}><FormattedMessage id='report.submit' defaultMessage='Submit report' /></Button>
+          <Button onClick={this.handleClick} disabled={isSubmitting}><FormattedMessage id='report.submit' defaultMessage='Submit report' /></Button>
         </div>
       </React.Fragment>
     );
diff --git a/app/javascript/flavours/glitch/features/report/statuses.js b/app/javascript/flavours/glitch/features/report/statuses.js
index 69cfbb3e5..47d5ee863 100644
--- a/app/javascript/flavours/glitch/features/report/statuses.js
+++ b/app/javascript/flavours/glitch/features/report/statuses.js
@@ -6,9 +6,11 @@ import StatusCheckBox from 'flavours/glitch/features/report/containers/status_ch
 import { OrderedSet } from 'immutable';
 import { FormattedMessage } from 'react-intl';
 import Button from 'flavours/glitch/components/button';
+import LoadingIndicator from 'flavours/glitch/components/loading_indicator';
 
 const mapStateToProps = (state, { accountId }) => ({
   availableStatusIds: OrderedSet(state.getIn(['timelines', `account:${accountId}:with_replies`, 'items'])),
+  isLoading: state.getIn(['timelines', `account:${accountId}:with_replies`, 'isLoading']),
 });
 
 export default @connect(mapStateToProps)
@@ -19,6 +21,7 @@ class Statuses extends React.PureComponent {
     accountId: PropTypes.string.isRequired,
     availableStatusIds: ImmutablePropTypes.set.isRequired,
     selectedStatusIds: ImmutablePropTypes.set.isRequired,
+    isLoading: PropTypes.bool,
     onToggle: PropTypes.func.isRequired,
   };
 
@@ -28,7 +31,7 @@ class Statuses extends React.PureComponent {
   };
 
   render () {
-    const { availableStatusIds, selectedStatusIds, onToggle } = this.props;
+    const { availableStatusIds, selectedStatusIds, onToggle, isLoading } = this.props;
 
     return (
       <React.Fragment>
@@ -36,7 +39,7 @@ class Statuses extends React.PureComponent {
         <p className='report-dialog-modal__lead'><FormattedMessage id='report.statuses.subtitle' defaultMessage='Select all that apply' /></p>
 
         <div className='report-dialog-modal__statuses'>
-          {availableStatusIds.union(selectedStatusIds).map(statusId => (
+          {isLoading ? <LoadingIndicator /> : availableStatusIds.union(selectedStatusIds).map(statusId => (
             <StatusCheckBox
               id={statusId}
               key={statusId}