From 44ea965557f6a7577218e475df4a9d671dcff506 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Sat, 23 May 2020 12:46:29 +0900 Subject: [Glitch] Fix local streaming of hashtag timelines Port 3a1a21ad5725bed7f82b516b4174272c1e931223 to glitch-soc Signed-off-by: Thibaut Girka --- .../flavours/glitch/features/hashtag_timeline/index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'app/javascript/flavours/glitch/features') diff --git a/app/javascript/flavours/glitch/features/hashtag_timeline/index.js b/app/javascript/flavours/glitch/features/hashtag_timeline/index.js index e94f36501..48e52e4cd 100644 --- a/app/javascript/flavours/glitch/features/hashtag_timeline/index.js +++ b/app/javascript/flavours/glitch/features/hashtag_timeline/index.js @@ -12,7 +12,7 @@ import { connectHashtagStream } from 'flavours/glitch/actions/streaming'; import { isEqual } from 'lodash'; 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) @@ -75,13 +75,13 @@ class HashtagTimeline extends React.PureComponent { this.column.scrollTop(); } - _subscribe (dispatch, id, tags = {}) { + _subscribe (dispatch, id, tags = {}, local) { let any = (tags.any || []).map(tag => tag.value); let all = (tags.all || []).map(tag => tag.value); let none = (tags.none || []).map(tag => tag.value); [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); return all.filter(tag => tags.includes(tag)).length === all.length && @@ -99,7 +99,7 @@ class HashtagTimeline extends React.PureComponent { const { dispatch } = this.props; const { id, tags, local } = this.props.params; - this._subscribe(dispatch, id, tags); + this._subscribe(dispatch, id, tags, local); dispatch(expandHashtagTimeline(id, { tags, local })); } @@ -109,8 +109,8 @@ class HashtagTimeline extends React.PureComponent { if (id !== params.id || !isEqual(tags, params.tags) || !isEqual(local, params.local)) { this._unsubscribe(); - this._subscribe(dispatch, id, tags); - dispatch(clearTimeline(`hashtag:${id}`)); + this._subscribe(dispatch, id, tags, local); + dispatch(clearTimeline(`hashtag:${id}${local ? ':local' : ''}`)); dispatch(expandHashtagTimeline(id, { tags, local })); } } @@ -130,7 +130,7 @@ class HashtagTimeline extends React.PureComponent { render () { const { hasUnread, columnId, multiColumn } = this.props; - const { id } = this.props.params; + const { id, local } = this.props.params; const pinned = !!columnId; return ( @@ -153,7 +153,7 @@ class HashtagTimeline extends React.PureComponent { } bindToDocument={!multiColumn} -- cgit