about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/account_gallery/index.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-06-11 17:07:35 +0200
committerGitHub <noreply@github.com>2017-06-11 17:07:35 +0200
commit47bf7a8047ce59b899d147e4483168f9852eeb7c (patch)
tree79dd51ed84b1ed350cd754c8fca988dd6718a93a /app/javascript/mastodon/features/account_gallery/index.js
parent85d405c810a3bfc146c7901d770444419f32e46f (diff)
Fix #3665 - Refactor timelines reducer (#3686)
* Move ancestors/descendants out of timelines reducer

* Refactor timelines reducer

All types of timelines now have a flat structure and use the same
reducer functions and actions

* Reintroduce some missing behaviours

* Fix wrong import in reports

* Fix includes typo

* Fix issue related to "next" pagination in timelines and notifications

* Fix bug with timeline's initial state, expandNotifications
Diffstat (limited to 'app/javascript/mastodon/features/account_gallery/index.js')
-rw-r--r--app/javascript/mastodon/features/account_gallery/index.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/app/javascript/mastodon/features/account_gallery/index.js b/app/javascript/mastodon/features/account_gallery/index.js
index a15419ac7..fcbee3c89 100644
--- a/app/javascript/mastodon/features/account_gallery/index.js
+++ b/app/javascript/mastodon/features/account_gallery/index.js
@@ -2,11 +2,8 @@ import React from 'react';
 import { connect } from 'react-redux';
 import ImmutablePropTypes from 'react-immutable-proptypes';
 import PropTypes from 'prop-types';
-import {
-  fetchAccount,
-  fetchAccountMediaTimeline,
-  expandAccountMediaTimeline,
-} from '../../actions/accounts';
+import { fetchAccount } from '../../actions/accounts';
+import { refreshAccountMediaTimeline, expandAccountMediaTimeline } from '../../actions/timelines';
 import LoadingIndicator from '../../components/loading_indicator';
 import Column from '../ui/components/column';
 import ColumnBackButton from '../../components/column_back_button';
@@ -21,8 +18,8 @@ import LoadMore from '../../components/load_more';
 
 const mapStateToProps = (state, props) => ({
   medias: getAccountGallery(state, Number(props.params.accountId)),
-  isLoading: state.getIn(['timelines', 'accounts_media_timelines', Number(props.params.accountId), 'isLoading']),
-  hasMore: !!state.getIn(['timelines', 'accounts_media_timelines', Number(props.params.accountId), 'next']),
+  isLoading: state.getIn(['timelines', `account:${Number(props.params.accountId)}:media`, 'isLoading']),
+  hasMore: !!state.getIn(['timelines', `account:${Number(props.params.accountId)}:media`, 'next']),
   autoPlayGif: state.getIn(['meta', 'auto_play_gif']),
 });
 
@@ -39,13 +36,13 @@ class AccountGallery extends ImmutablePureComponent {
 
   componentDidMount () {
     this.props.dispatch(fetchAccount(Number(this.props.params.accountId)));
-    this.props.dispatch(fetchAccountMediaTimeline(Number(this.props.params.accountId)));
+    this.props.dispatch(refreshAccountMediaTimeline(Number(this.props.params.accountId)));
   }
 
   componentWillReceiveProps (nextProps) {
     if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
       this.props.dispatch(fetchAccount(Number(nextProps.params.accountId)));
-      this.props.dispatch(fetchAccountMediaTimeline(Number(this.props.params.accountId)));
+      this.props.dispatch(refreshAccountMediaTimeline(Number(this.props.params.accountId)));
     }
   }