about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/followers/index.js
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-09-27 07:23:48 +0200
committerGitHub <noreply@github.com>2021-09-27 07:23:48 +0200
commit11502ae46e4813bc23aeb5d03093a01d53991ab8 (patch)
tree153f5953b8d144f78885fdeb3d04b7213ea9a26d /app/javascript/mastodon/features/followers/index.js
parenta0d4129893c797f78d28ba9df5d35646f7bb0d80 (diff)
Add aliases for WebUI routes that were renamed in #16171 (#16772)
* Add aliases for some WebUI routes that were renamed in #16171

Accounts and statuses routes need more work as they use different parameters.

* Add aliases for /statuses/* routes

* Add aliases for /accounts/* WebUI routes

Does not correctly set the “active” state on the navigation tabs but this is
a minor issue.

* Fix some routes

* Fix /accounts/:id/{media,followers,following} not loading on legacy routes
Diffstat (limited to 'app/javascript/mastodon/features/followers/index.js')
-rw-r--r--app/javascript/mastodon/features/followers/index.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/javascript/mastodon/features/followers/index.js b/app/javascript/mastodon/features/followers/index.js
index 3193ce322..224e74b3d 100644
--- a/app/javascript/mastodon/features/followers/index.js
+++ b/app/javascript/mastodon/features/followers/index.js
@@ -7,6 +7,7 @@ import { debounce } from 'lodash';
 import LoadingIndicator from '../../components/loading_indicator';
 import {
   lookupAccount,
+  fetchAccount,
   fetchFollowers,
   expandFollowers,
 } from '../../actions/accounts';
@@ -19,8 +20,8 @@ import ScrollableList from '../../components/scrollable_list';
 import MissingIndicator from 'mastodon/components/missing_indicator';
 import TimelineHint from 'mastodon/components/timeline_hint';
 
-const mapStateToProps = (state, { params: { acct } }) => {
-  const accountId = state.getIn(['accounts_map', acct]);
+const mapStateToProps = (state, { params: { acct, id } }) => {
+  const accountId = id || state.getIn(['accounts_map', acct]);
 
   if (!accountId) {
     return {
@@ -53,7 +54,8 @@ class Followers extends ImmutablePureComponent {
 
   static propTypes = {
     params: PropTypes.shape({
-      acct: PropTypes.string.isRequired,
+      acct: PropTypes.string,
+      id: PropTypes.string,
     }).isRequired,
     accountId: PropTypes.string,
     dispatch: PropTypes.func.isRequired,
@@ -68,8 +70,9 @@ class Followers extends ImmutablePureComponent {
   };
 
   _load () {
-    const { accountId, dispatch } = this.props;
+    const { accountId, isAccount, dispatch } = this.props;
 
+    if (!isAccount) dispatch(fetchAccount(accountId));
     dispatch(fetchFollowers(accountId));
   }