Removed streaming for group, group_collection, hashtag, link timelines

• Removed:
- streaming for group, group_collection, hashtag, link timelines
This commit is contained in:
mgabdev
2020-11-04 21:09:27 -06:00
parent 880dad7b5a
commit f2f3382677
7 changed files with 3 additions and 210 deletions

View File

@@ -52,11 +52,7 @@ export function connectTimelineStream (timelineId, path, pollingRefresh = null,
export const connectUserStream = () => connectTimelineStream('home', 'user');
export const connectProStream = () => connectTimelineStream('pro', 'pro');
export const connectLinkStream = (linkId, accept) => connectTimelineStream(`link:${linkId}`, `link&linkId=${linkId}`, null, accept);
export const connectHashtagStream = (id, tag, accept) => connectTimelineStream(`hashtag:${id}`, `hashtag&tag=${tag}`, null, accept);
export const connectListStream = id => connectTimelineStream(`list:${id}`, `list&list=${id}`);
export const connectGroupStream = id => connectTimelineStream(`group:${id}`, `group&group=${id}`);
export const connectGroupCollectionStream = (collectionType, sortBy) => connectTimelineStream(`group_collection:${collectionType}:${sortBy}`, `group_collection&group_collection=${collectionType}`);
export const connectStatusUpdateStream = () => {
return connectStream('statuscard', null, (dispatch, getState) => {

View File

@@ -4,7 +4,6 @@ import { connect } from 'react-redux'
import { injectIntl, defineMessages } from 'react-intl'
import { List as ImmutableList } from 'immutable'
import { me } from '../initial_state'
import { connectGroupCollectionStream } from '../actions/streaming'
import {
clearTimeline,
expandGroupCollectionTimeline,
@@ -30,28 +29,6 @@ class GroupCollectionTimeline extends React.PureComponent {
loadCount: 0,
}
_unsubscribe() {
if (this.disconnect && !!me) {
this.disconnect()
this.disconnect = null
}
}
_subscribe = () => {
if (!!me) {
const {
collectionType,
sortByValue,
sortByTopValue,
} = this.props
if (collectionType === 'member' && sortByValue === 'new') {
const sortBy = getSortBy(sortByValue, sortByTopValue)
this.disconnect = this.props.onConnectGroupCollectionStream(collectionType, sortBy)
}
}
}
componentDidMount() {
const {
collectionType,
@@ -66,8 +43,6 @@ class GroupCollectionTimeline extends React.PureComponent {
} else {
const sortBy = getSortBy(sortByValue, sortByTopValue)
this.props.onExpandGroupCollectionTimeline(collectionType, { sortBy })
this._subscribe()
}
}
@@ -75,17 +50,11 @@ class GroupCollectionTimeline extends React.PureComponent {
if (prevProps.sortByValue !== this.props.sortByValue ||
prevProps.sortByTopValue !== this.props.sortByTopValue ||
prevProps.collectionType !== this.props.collectionType) {
this._unsubscribe()
this._subscribe()
this.props.onClearTimeline(`group_collection:${prevProps.collectionType}`)
this.handleLoadMore()
}
}
componentWillUnmount() {
this._unsubscribe()
}
handleLoadMore = (maxId) => {
const {
collectionType,
@@ -162,9 +131,6 @@ const mapStateToProps = (state) => {
}
const mapDispatchToProps = (dispatch) => ({
onConnectGroupCollectionStream(collectionType, sortBy) {
dispatch(connectGroupCollectionStream(collectionType, sortBy))
},
onClearTimeline(timeline) {
dispatch(clearTimeline(timeline))
},
@@ -181,7 +147,6 @@ const mapDispatchToProps = (dispatch) => ({
GroupCollectionTimeline.propTypes = {
params: PropTypes.object.isRequired,
onConnectGroupCollectionStream: PropTypes.func.isRequired,
onClearTimeline: PropTypes.func.isRequired,
onExpandGroupCollectionTimeline: PropTypes.func.isRequired,
setFeaturedTop: PropTypes.func.isRequired,

View File

@@ -7,7 +7,6 @@ import { List as ImmutableList } from 'immutable'
import { injectIntl, defineMessages } from 'react-intl'
import { me } from '../initial_state'
import getSortBy from '../utils/group_sort_by'
import { connectGroupStream } from '../actions/streaming'
import {
clearTimeline,
expandGroupTimeline,
@@ -46,10 +45,6 @@ class GroupTimeline extends ImmutablePureComponent {
this.props.onExpandGroupFeaturedTimeline(groupId)
this.props.onExpandGroupTimeline(groupId, { sortBy, onlyMedia })
if (!!me) {
this.disconnect = this.props.onConnectGroupStream(groupId)
}
}
}
@@ -67,13 +62,6 @@ class GroupTimeline extends ImmutablePureComponent {
}
}
componentWillUnmount() {
if (this.disconnect && !!me) {
this.disconnect()
this.disconnect = null
}
}
handleLoadMore = (maxId) => {
const {
groupId,
@@ -142,9 +130,6 @@ const mapStateToProps = (state, props) => ({
})
const mapDispatchToProps = (dispatch) => ({
onConnectGroupStream(groupId) {
dispatch(connectGroupStream(groupId))
},
onClearTimeline(timelineId) {
dispatch(clearTimeline(timelineId))
},
@@ -167,7 +152,6 @@ GroupTimeline.propTypes = {
]),
groupId: PropTypes.string,
intl: PropTypes.object.isRequired,
onConnectGroupStream: PropTypes.func.isRequired,
onClearTimeline: PropTypes.func.isRequired,
onExpandGroupTimeline: PropTypes.func.isRequired,
onExpandGroupFeaturedTimeline: PropTypes.func.isRequired,

View File

@@ -4,13 +4,10 @@ import { connect } from 'react-redux'
import { FormattedMessage } from 'react-intl'
import isEqual from 'lodash.isequal'
import { expandHashtagTimeline, clearTimeline } from '../actions/timelines'
import { connectHashtagStream } from '../actions/streaming'
import StatusList from '../components/status_list'
class HashtagTimeline extends React.PureComponent {
disconnects = [];
title = () => {
const title = [this.props.params.id]
@@ -66,31 +63,10 @@ class HashtagTimeline extends React.PureComponent {
}
}
_subscribe (dispatch, id, tags = {}) {
const any = (tags.any || []).map(tag => tag.value)
const all = (tags.all || []).map(tag => tag.value)
const none = (tags.none || []).map(tag => tag.value);
[id, ...any].map(tag => {
this.disconnects.push(dispatch(connectHashtagStream(id, tag, status => {
const tags = status.tags.map(tag => tag.name)
return all.filter(tag => tags.includes(tag)).length === all.length &&
none.filter(tag => tags.includes(tag)).length === 0
})))
})
}
_unsubscribe () {
this.disconnects.map(disconnect => disconnect())
this.disconnects = []
}
componentDidMount () {
const { dispatch } = this.props
const { id, tags } = this.props.params
this._subscribe(dispatch, id, tags)
dispatch(expandHashtagTimeline(id, { tags }))
}
@@ -99,18 +75,12 @@ class HashtagTimeline extends React.PureComponent {
const { id, tags } = nextProps.params
if (id !== params.id || !isEqual(tags, params.tags)) {
this._unsubscribe()
this._subscribe(dispatch, id, tags)
this.props.dispatch(clearTimeline(`hashtag:${id}`))
this.props.dispatch(expandHashtagTimeline(id, { tags }))
}
}
componentWillUnmount () {
this._unsubscribe()
}
handleLoadMore = maxId => {
handleLoadMore = (maxId) => {
const { id, tags } = this.props.params
this.props.dispatch(expandHashtagTimeline(id, { maxId, tags }))
}

View File

@@ -4,7 +4,6 @@ import { connect } from 'react-redux'
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { FormattedMessage } from 'react-intl'
import { connectLinkStream } from '../actions/streaming'
import { expandLinkTimeline } from '../actions/timelines'
import { fetchLinkCard } from '../actions/links'
import { openModal } from '../actions/modal'
@@ -25,13 +24,8 @@ class LinkTimeline extends ImmutablePureComponent {
this.handleConnect(this.props.params.id)
}
componentWillUnmount() {
this.handleDisconnect()
}
componentWillReceiveProps(nextProps) {
if (nextProps.params.id !== this.props.params.id) {
this.handleDisconnect()
this.handleConnect(nextProps.params.id)
}
}
@@ -41,15 +35,6 @@ class LinkTimeline extends ImmutablePureComponent {
dispatch(fetchLinkCard(id))
dispatch(expandLinkTimeline(id))
this.disconnect = dispatch(connectLinkStream(id))
}
handleDisconnect() {
if (this.disconnect) {
this.disconnect()
this.disconnect = null
}
}
handleLoadMore = (maxId) => {