about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-02-23 21:44:09 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-02-23 21:44:09 +0100
commitfc2c65d79f1837c68b53c25a86989acd768e57bd (patch)
tree6da3e5e9d39ee4fb60125fd9e1dfb1c64d1ea988
parentaafe91259a99c9333f2e597eb629bc3df2d585fc (diff)
parentb7cf11d5a93530f736b1584f0d13d8fe50f45ccf (diff)
Merge branch 'main' into glitch-soc/merge-upstream
-rw-r--r--app/javascript/mastodon/actions/reports.js2
-rw-r--r--app/javascript/mastodon/reducers/index.js2
-rw-r--r--app/javascript/mastodon/reducers/reports.js64
3 files changed, 1 insertions, 67 deletions
diff --git a/app/javascript/mastodon/actions/reports.js b/app/javascript/mastodon/actions/reports.js
index 7a7bed04e..fbe5b3791 100644
--- a/app/javascript/mastodon/actions/reports.js
+++ b/app/javascript/mastodon/actions/reports.js
@@ -8,7 +8,7 @@ export const REPORT_SUBMIT_FAIL    = 'REPORT_SUBMIT_FAIL';
 export const initReport = (account, status) => dispatch =>
   dispatch(openModal('REPORT', {
     accountId: account.get('id'),
-    statusId: status.get('id'),
+    statusId: status?.get('id'),
   }));
 
 export const submitReport = (params, onSuccess, onFail) => (dispatch, getState) => {
diff --git a/app/javascript/mastodon/reducers/index.js b/app/javascript/mastodon/reducers/index.js
index ce4ef991d..0219d8a5e 100644
--- a/app/javascript/mastodon/reducers/index.js
+++ b/app/javascript/mastodon/reducers/index.js
@@ -17,7 +17,6 @@ import status_lists from './status_lists';
 import mutes from './mutes';
 import blocks from './blocks';
 import boosts from './boosts';
-// import reports from './reports';
 import rules from './rules';
 import contexts from './contexts';
 import compose from './compose';
@@ -62,7 +61,6 @@ const reducers = {
   mutes,
   blocks,
   boosts,
-  // reports,
   rules,
   contexts,
   compose,
diff --git a/app/javascript/mastodon/reducers/reports.js b/app/javascript/mastodon/reducers/reports.js
deleted file mode 100644
index 21ae6f93f..000000000
--- a/app/javascript/mastodon/reducers/reports.js
+++ /dev/null
@@ -1,64 +0,0 @@
-import {
-  REPORT_INIT,
-  REPORT_SUBMIT_REQUEST,
-  REPORT_SUBMIT_SUCCESS,
-  REPORT_SUBMIT_FAIL,
-  REPORT_CANCEL,
-  REPORT_STATUS_TOGGLE,
-  REPORT_COMMENT_CHANGE,
-  REPORT_FORWARD_CHANGE,
-} from '../actions/reports';
-import { Map as ImmutableMap, Set as ImmutableSet } from 'immutable';
-
-const initialState = ImmutableMap({
-  new: ImmutableMap({
-    isSubmitting: false,
-    account_id: null,
-    status_ids: ImmutableSet(),
-    comment: '',
-    forward: false,
-  }),
-});
-
-export default function reports(state = initialState, action) {
-  switch(action.type) {
-  case REPORT_INIT:
-    return state.withMutations(map => {
-      map.setIn(['new', 'isSubmitting'], false);
-      map.setIn(['new', 'account_id'], action.account.get('id'));
-
-      if (state.getIn(['new', 'account_id']) !== action.account.get('id')) {
-        map.setIn(['new', 'status_ids'], action.status ? ImmutableSet([action.status.getIn(['reblog', 'id'], action.status.get('id'))]) : ImmutableSet());
-        map.setIn(['new', 'comment'], '');
-      } else if (action.status) {
-        map.updateIn(['new', 'status_ids'], ImmutableSet(), set => set.add(action.status.getIn(['reblog', 'id'], action.status.get('id'))));
-      }
-    });
-  case REPORT_STATUS_TOGGLE:
-    return state.updateIn(['new', 'status_ids'], ImmutableSet(), set => {
-      if (action.checked) {
-        return set.add(action.statusId);
-      }
-
-      return set.remove(action.statusId);
-    });
-  case REPORT_COMMENT_CHANGE:
-    return state.setIn(['new', 'comment'], action.comment);
-  case REPORT_FORWARD_CHANGE:
-    return state.setIn(['new', 'forward'], action.forward);
-  case REPORT_SUBMIT_REQUEST:
-    return state.setIn(['new', 'isSubmitting'], true);
-  case REPORT_SUBMIT_FAIL:
-    return state.setIn(['new', 'isSubmitting'], false);
-  case REPORT_CANCEL:
-  case REPORT_SUBMIT_SUCCESS:
-    return state.withMutations(map => {
-      map.setIn(['new', 'account_id'], null);
-      map.setIn(['new', 'status_ids'], ImmutableSet());
-      map.setIn(['new', 'comment'], '');
-      map.setIn(['new', 'isSubmitting'], false);
-    });
-  default:
-    return state;
-  }
-};