|
|
|
@ -15,6 +15,7 @@ import {
|
|
|
|
|
COMPOSE_UPLOAD_FAIL,
|
|
|
|
|
COMPOSE_UPLOAD_UNDO,
|
|
|
|
|
COMPOSE_UPLOAD_PROGRESS,
|
|
|
|
|
COMPOSE_UPLOAD_PROCESSING,
|
|
|
|
|
THUMBNAIL_UPLOAD_REQUEST,
|
|
|
|
|
THUMBNAIL_UPLOAD_SUCCESS,
|
|
|
|
|
THUMBNAIL_UPLOAD_FAIL,
|
|
|
|
@ -223,6 +224,7 @@ function appendMedia(state, media, file) {
|
|
|
|
|
}
|
|
|
|
|
map.update('media_attachments', list => list.push(media));
|
|
|
|
|
map.set('is_uploading', false);
|
|
|
|
|
map.set('is_processing', false);
|
|
|
|
|
map.set('resetFileKey', Math.floor((Math.random() * 0x10000)));
|
|
|
|
|
map.set('idempotencyKey', uuid());
|
|
|
|
|
map.update('pending_media_attachments', n => n - 1);
|
|
|
|
@ -465,10 +467,12 @@ export default function compose(state = initialState, action) {
|
|
|
|
|
return state.set('is_changing_upload', false);
|
|
|
|
|
case COMPOSE_UPLOAD_REQUEST:
|
|
|
|
|
return state.set('is_uploading', true).update('pending_media_attachments', n => n + 1);
|
|
|
|
|
case COMPOSE_UPLOAD_PROCESSING:
|
|
|
|
|
return state.set('is_processing', true);
|
|
|
|
|
case COMPOSE_UPLOAD_SUCCESS:
|
|
|
|
|
return appendMedia(state, fromJS(action.media), action.file);
|
|
|
|
|
case COMPOSE_UPLOAD_FAIL:
|
|
|
|
|
return state.set('is_uploading', false).update('pending_media_attachments', n => n - 1);
|
|
|
|
|
return state.set('is_uploading', false).set('is_processing', false).update('pending_media_attachments', n => n - 1);
|
|
|
|
|
case COMPOSE_UPLOAD_UNDO:
|
|
|
|
|
return removeMedia(state, action.media_id);
|
|
|
|
|
case COMPOSE_UPLOAD_PROGRESS:
|
|
|
|
|