Added timeline dequeue functionality to onSubmitCompose action

when a status is composed and there's queued statuses, it attempts to dequeue those statuses with optional dequeueArgs
This commit is contained in:
mgabdev 2019-07-11 12:10:46 -04:00
parent 0356e21747
commit ebc44ed743
1 changed files with 5 additions and 1 deletions

View File

@ -6,7 +6,7 @@ import { tagHistory } from '../settings';
import { useEmoji } from './emojis';
import resizeImage from '../utils/resize_image';
import { importFetchedAccounts } from './importer';
import { updateTimeline } from './timelines';
import { updateTimeline, dequeueTimeline } from './timelines';
import { showAlertForError } from './alerts';
import { showAlert } from './alerts';
import { defineMessages } from 'react-intl';
@ -168,6 +168,10 @@ export function submitCompose(routerHistory) {
const timeline = getState().getIn(['timelines', timelineId]);
if (timeline && timeline.get('items').size > 0 && timeline.getIn(['items', 0]) !== null && timeline.get('online')) {
let dequeueArgs = {};
if (timelineId === 'community') dequeueArgs.onlyMedia = getState().getIn(['settings', 'community', 'other', 'onlyMedia']),
dispatch(dequeueTimeline(timelineId, null, dequeueArgs));
dispatch(updateTimeline(timelineId, { ...response.data }));
}
};