Fix upload progress not communicating processing phase in web UI (#19530)
This commit is contained in:
parent
a449ee8654
commit
30ef110224
5 changed files with 34 additions and 13 deletions
|
@ -14,6 +14,7 @@ import {
|
|||
COMPOSE_UPLOAD_FAIL,
|
||||
COMPOSE_UPLOAD_UNDO,
|
||||
COMPOSE_UPLOAD_PROGRESS,
|
||||
COMPOSE_UPLOAD_PROCESSING,
|
||||
THUMBNAIL_UPLOAD_REQUEST,
|
||||
THUMBNAIL_UPLOAD_SUCCESS,
|
||||
THUMBNAIL_UPLOAD_FAIL,
|
||||
|
@ -136,6 +137,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);
|
||||
|
@ -354,10 +356,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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue