|
|
@ -12,7 +12,7 @@ import { connectHashtagStream } from '../../actions/streaming';
|
|
|
|
import { isEqual } from 'lodash';
|
|
|
|
import { isEqual } from 'lodash';
|
|
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state, props) => ({
|
|
|
|
const mapStateToProps = (state, props) => ({
|
|
|
|
hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}`, 'unread']) > 0,
|
|
|
|
hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}${props.params.local ? ':local' : ''}`, 'unread']) > 0,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
export default @connect(mapStateToProps)
|
|
|
|
export default @connect(mapStateToProps)
|
|
|
@ -76,13 +76,13 @@ class HashtagTimeline extends React.PureComponent {
|
|
|
|
this.column.scrollTop();
|
|
|
|
this.column.scrollTop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_subscribe (dispatch, id, tags = {}) {
|
|
|
|
_subscribe (dispatch, id, tags = {}, local) {
|
|
|
|
let any = (tags.any || []).map(tag => tag.value);
|
|
|
|
let any = (tags.any || []).map(tag => tag.value);
|
|
|
|
let all = (tags.all || []).map(tag => tag.value);
|
|
|
|
let all = (tags.all || []).map(tag => tag.value);
|
|
|
|
let none = (tags.none || []).map(tag => tag.value);
|
|
|
|
let none = (tags.none || []).map(tag => tag.value);
|
|
|
|
|
|
|
|
|
|
|
|
[id, ...any].map(tag => {
|
|
|
|
[id, ...any].map(tag => {
|
|
|
|
this.disconnects.push(dispatch(connectHashtagStream(id, tag, status => {
|
|
|
|
this.disconnects.push(dispatch(connectHashtagStream(id, tag, local, status => {
|
|
|
|
let tags = status.tags.map(tag => tag.name);
|
|
|
|
let tags = status.tags.map(tag => tag.name);
|
|
|
|
|
|
|
|
|
|
|
|
return all.filter(tag => tags.includes(tag)).length === all.length &&
|
|
|
|
return all.filter(tag => tags.includes(tag)).length === all.length &&
|
|
|
@ -100,7 +100,7 @@ class HashtagTimeline extends React.PureComponent {
|
|
|
|
const { dispatch } = this.props;
|
|
|
|
const { dispatch } = this.props;
|
|
|
|
const { id, tags, local } = this.props.params;
|
|
|
|
const { id, tags, local } = this.props.params;
|
|
|
|
|
|
|
|
|
|
|
|
this._subscribe(dispatch, id, tags);
|
|
|
|
this._subscribe(dispatch, id, tags, local);
|
|
|
|
dispatch(expandHashtagTimeline(id, { tags, local }));
|
|
|
|
dispatch(expandHashtagTimeline(id, { tags, local }));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -110,8 +110,8 @@ class HashtagTimeline extends React.PureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
if (id !== params.id || !isEqual(tags, params.tags) || !isEqual(local, params.local)) {
|
|
|
|
if (id !== params.id || !isEqual(tags, params.tags) || !isEqual(local, params.local)) {
|
|
|
|
this._unsubscribe();
|
|
|
|
this._unsubscribe();
|
|
|
|
this._subscribe(dispatch, id, tags);
|
|
|
|
this._subscribe(dispatch, id, tags, local);
|
|
|
|
dispatch(clearTimeline(`hashtag:${id}`));
|
|
|
|
dispatch(clearTimeline(`hashtag:${id}${local ? ':local' : ''}`));
|
|
|
|
dispatch(expandHashtagTimeline(id, { tags, local }));
|
|
|
|
dispatch(expandHashtagTimeline(id, { tags, local }));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -131,7 +131,7 @@ class HashtagTimeline extends React.PureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
|
render () {
|
|
|
|
const { shouldUpdateScroll, hasUnread, columnId, multiColumn } = this.props;
|
|
|
|
const { shouldUpdateScroll, hasUnread, columnId, multiColumn } = this.props;
|
|
|
|
const { id } = this.props.params;
|
|
|
|
const { id, local } = this.props.params;
|
|
|
|
const pinned = !!columnId;
|
|
|
|
const pinned = !!columnId;
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -153,7 +153,7 @@ class HashtagTimeline extends React.PureComponent {
|
|
|
|
<StatusListContainer
|
|
|
|
<StatusListContainer
|
|
|
|
trackScroll={!pinned}
|
|
|
|
trackScroll={!pinned}
|
|
|
|
scrollKey={`hashtag_timeline-${columnId}`}
|
|
|
|
scrollKey={`hashtag_timeline-${columnId}`}
|
|
|
|
timelineId={`hashtag:${id}`}
|
|
|
|
timelineId={`hashtag:${id}${local ? ':local' : ''}`}
|
|
|
|
onLoadMore={this.handleLoadMore}
|
|
|
|
onLoadMore={this.handleLoadMore}
|
|
|
|
emptyMessage={<FormattedMessage id='empty_column.hashtag' defaultMessage='There is nothing in this hashtag yet.' />}
|
|
|
|
emptyMessage={<FormattedMessage id='empty_column.hashtag' defaultMessage='There is nothing in this hashtag yet.' />}
|
|
|
|
shouldUpdateScroll={shouldUpdateScroll}
|
|
|
|
shouldUpdateScroll={shouldUpdateScroll}
|
|
|
|