Removed promotion code in StatusList
• Removed: - promotion code in StatusList • Todo: - Implement in a better fashion
This commit is contained in:
parent
ef724069a9
commit
c65c71fffe
@ -5,13 +5,10 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
|
|||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import sample from 'lodash.sample';
|
import sample from 'lodash.sample';
|
||||||
import debounce from 'lodash.debounce'
|
import debounce from 'lodash.debounce'
|
||||||
import { me, promotions } from '../initial_state';
|
import { me } from '../initial_state';
|
||||||
import { dequeueTimeline } from '../actions/timelines';
|
import { dequeueTimeline } from '../actions/timelines';
|
||||||
import { scrollTopTimeline } from '../actions/timelines';
|
import { scrollTopTimeline } from '../actions/timelines';
|
||||||
import {
|
import { fetchContext } from '../actions/statuses';
|
||||||
fetchStatus,
|
|
||||||
fetchContext,
|
|
||||||
} from '../actions/statuses';
|
|
||||||
import StatusContainer from '../containers/status_container';
|
import StatusContainer from '../containers/status_container';
|
||||||
import ScrollableList from './scrollable_list';
|
import ScrollableList from './scrollable_list';
|
||||||
import TimelineQueueButtonHeader from './timeline_queue_button_header';
|
import TimelineQueueButtonHeader from './timeline_queue_button_header';
|
||||||
@ -44,7 +41,6 @@ const mapStateToProps = (state, { timelineId }) => {
|
|||||||
if (!timelineId) return {}
|
if (!timelineId) return {}
|
||||||
|
|
||||||
const getStatusIds = makeGetStatusIds();
|
const getStatusIds = makeGetStatusIds();
|
||||||
const promotion = promotions.length > 0 && sample(promotions.filter(p => p.timeline_id === timelineId));
|
|
||||||
|
|
||||||
const statusIds = getStatusIds(state, {
|
const statusIds = getStatusIds(state, {
|
||||||
type: timelineId.substring(0, 5) === 'group' ? 'group' : timelineId,
|
type: timelineId.substring(0, 5) === 'group' ? 'group' : timelineId,
|
||||||
@ -57,8 +53,6 @@ const mapStateToProps = (state, { timelineId }) => {
|
|||||||
isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false),
|
isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false),
|
||||||
hasMore: state.getIn(['timelines', timelineId, 'hasMore']),
|
hasMore: state.getIn(['timelines', timelineId, 'hasMore']),
|
||||||
totalQueuedItemsCount: state.getIn(['timelines', timelineId, 'totalQueuedItemsCount']),
|
totalQueuedItemsCount: state.getIn(['timelines', timelineId, 'totalQueuedItemsCount']),
|
||||||
promotion: promotion,
|
|
||||||
promotedStatus: promotion && state.getIn(['statuses', promotion.status_id])
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -72,9 +66,6 @@ const mapDispatchToProps = (dispatch, ownProps) => ({
|
|||||||
onScroll: debounce(() => {
|
onScroll: debounce(() => {
|
||||||
dispatch(scrollTopTimeline(ownProps.timelineId, false));
|
dispatch(scrollTopTimeline(ownProps.timelineId, false));
|
||||||
}, 100),
|
}, 100),
|
||||||
fetchStatus(id) {
|
|
||||||
dispatch(fetchStatus(id));
|
|
||||||
},
|
|
||||||
onFetchContext(statusId) {
|
onFetchContext(statusId) {
|
||||||
dispatch(fetchContext(statusId, true))
|
dispatch(fetchContext(statusId, true))
|
||||||
},
|
},
|
||||||
@ -99,9 +90,6 @@ class StatusList extends ImmutablePureComponent {
|
|||||||
group: ImmutablePropTypes.map,
|
group: ImmutablePropTypes.map,
|
||||||
onScrollToTop: PropTypes.func,
|
onScrollToTop: PropTypes.func,
|
||||||
onScroll: PropTypes.func,
|
onScroll: PropTypes.func,
|
||||||
promotion: PropTypes.object, // : todo :
|
|
||||||
promotedStatus: ImmutablePropTypes.map,
|
|
||||||
fetchStatus: PropTypes.func,
|
|
||||||
onFetchContext: PropTypes.func,
|
onFetchContext: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +100,6 @@ class StatusList extends ImmutablePureComponent {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.handleDequeueTimeline();
|
this.handleDequeueTimeline();
|
||||||
this.fetchPromotedStatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
@ -121,14 +108,6 @@ class StatusList extends ImmutablePureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchPromotedStatus() {
|
|
||||||
const { promotion, promotedStatus, fetchStatus } = this.props;
|
|
||||||
|
|
||||||
if (promotion && !promotedStatus) {
|
|
||||||
fetchStatus(promotion.status_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchContextsForInitialStatuses = (statusIds) => {
|
fetchContextsForInitialStatuses = (statusIds) => {
|
||||||
// console.log("fetchContextsForInitialStatuses:", statusIds)
|
// console.log("fetchContextsForInitialStatuses:", statusIds)
|
||||||
for (let i = 0; i < statusIds.length; i++) {
|
for (let i = 0; i < statusIds.length; i++) {
|
||||||
@ -207,8 +186,6 @@ class StatusList extends ImmutablePureComponent {
|
|||||||
isLoading,
|
isLoading,
|
||||||
isPartial,
|
isPartial,
|
||||||
group,
|
group,
|
||||||
promotion,
|
|
||||||
promotedStatus,
|
|
||||||
...other
|
...other
|
||||||
} = this.props
|
} = this.props
|
||||||
const { fetchedContext, refreshing } = this.state
|
const { fetchedContext, refreshing } = this.state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user