about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-12-03 21:04:57 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-12-03 21:04:57 +0100
commit565cd95bcae1f3814c46191a3f22289313620321 (patch)
tree3a22496bc9c40436b15cad4e6718c0b1f2203eeb /app/assets/javascripts/components/features
parentb14b5e3b448eafa1489d6fe4b702621e25dff1ae (diff)
Keep timelines in the UI trimmed when possible
Diffstat (limited to 'app/assets/javascripts/components/features')
-rw-r--r--app/assets/javascripts/components/features/hashtag_timeline/index.jsx4
-rw-r--r--app/assets/javascripts/components/features/ui/containers/status_list_container.jsx13
2 files changed, 13 insertions, 4 deletions
diff --git a/app/assets/javascripts/components/features/hashtag_timeline/index.jsx b/app/assets/javascripts/components/features/hashtag_timeline/index.jsx
index bea0a2759..cf53a7729 100644
--- a/app/assets/javascripts/components/features/hashtag_timeline/index.jsx
+++ b/app/assets/javascripts/components/features/hashtag_timeline/index.jsx
@@ -47,13 +47,13 @@ const HashtagTimeline = React.createClass({
     const { dispatch } = this.props;
     const { id } = this.props.params;
 
-    dispatch(refreshTimeline('tag', true, id));
+    dispatch(refreshTimeline('tag', id));
     this._subscribe(dispatch, id);
   },
 
   componentWillReceiveProps (nextProps) {
     if (nextProps.params.id !== this.props.params.id) {
-      this.props.dispatch(refreshTimeline('tag', true, nextProps.params.id));
+      this.props.dispatch(refreshTimeline('tag', nextProps.params.id));
       this._unsubscribe();
       this._subscribe(this.props.dispatch, nextProps.params.id);
     }
diff --git a/app/assets/javascripts/components/features/ui/containers/status_list_container.jsx b/app/assets/javascripts/components/features/ui/containers/status_list_container.jsx
index 8004e3f04..1621cec7b 100644
--- a/app/assets/javascripts/components/features/ui/containers/status_list_container.jsx
+++ b/app/assets/javascripts/components/features/ui/containers/status_list_container.jsx
@@ -1,16 +1,25 @@
 import { connect } from 'react-redux';
 import StatusList from '../../../components/status_list';
-import { expandTimeline } from '../../../actions/timelines';
+import { expandTimeline, scrollTopTimeline } from '../../../actions/timelines';
 import Immutable from 'immutable';
 
 const mapStateToProps = (state, props) => ({
-  statusIds: state.getIn(['timelines', props.type], Immutable.List())
+  statusIds: state.getIn(['timelines', props.type, 'items'], Immutable.List())
 });
 
 const mapDispatchToProps = function (dispatch, props) {
   return {
     onScrollToBottom () {
+      dispatch(scrollTopTimeline(props.type, false));
       dispatch(expandTimeline(props.type, props.id));
+    },
+
+    onScrollToTop () {
+      dispatch(scrollTopTimeline(props.type, true));
+    },
+
+    onScroll () {
+      dispatch(scrollTopTimeline(props.type, false));
     }
   };
 };