Updated insertIfOnline functionality in actions/compose for submitComposeSuccess

• Updated:
- insertIfOnline functionality in actions/compose for submitComposeSuccess
This commit is contained in:
mgabdev 2020-08-12 17:59:23 -05:00
parent bbfd3531e3
commit eae6f70b3f

View File

@ -252,22 +252,19 @@ export function handleComposeSubmit(dispatch, getState, response, status) {
dispatch(insertIntoTagHistory(response.data.tags, status));
dispatch(submitComposeSuccess({ ...response.data }));
// To make the app more responsive, immediately push the status into the columns
// To make the app more responsive, immediately push the status into the timeline
// : todo : push into comment, reload parent status, etc.
const insertIfOnline = timelineId => {
const timeline = getState().getIn(['timelines', timelineId]);
if (timeline && timeline.get('items').size > 0 && timeline.getIn(['items', 0]) !== null && timeline.get('online')) {
const dequeueArgs = {};
if (timelineId === 'community') dequeueArgs.onlyMedia = getState().getIn(['settings', 'community', 'other', 'onlyMedia']);
dispatch(dequeueTimeline(timelineId, null, dequeueArgs));
dispatch(updateTimelineQueue(timelineId, response.data))
dispatch(updateTimeline(timelineId, { ...response.data }));
}
};
if (response.data.visibility === 'public') {
insertIfOnline('home');
insertIfOnline('community');
insertIfOnline('public');
}
}