|
|
@ -67,6 +67,7 @@ const initialState = ImmutableMap({ |
|
|
|
in_reply_to: null, |
|
|
|
in_reply_to: null, |
|
|
|
is_submitting: false, |
|
|
|
is_submitting: false, |
|
|
|
is_uploading: false, |
|
|
|
is_uploading: false, |
|
|
|
|
|
|
|
is_changing_upload: false, |
|
|
|
progress: 0, |
|
|
|
progress: 0, |
|
|
|
media_attachments: ImmutableList(), |
|
|
|
media_attachments: ImmutableList(), |
|
|
|
suggestion_token: null, |
|
|
|
suggestion_token: null, |
|
|
@ -130,6 +131,7 @@ function clearAll(state) { |
|
|
|
map.set('spoiler', false); |
|
|
|
map.set('spoiler', false); |
|
|
|
map.set('spoiler_text', ''); |
|
|
|
map.set('spoiler_text', ''); |
|
|
|
map.set('is_submitting', false); |
|
|
|
map.set('is_submitting', false); |
|
|
|
|
|
|
|
map.set('is_changing_upload', false); |
|
|
|
map.set('in_reply_to', null); |
|
|
|
map.set('in_reply_to', null); |
|
|
|
map.update( |
|
|
|
map.update( |
|
|
|
'advanced_options', |
|
|
|
'advanced_options', |
|
|
@ -341,13 +343,15 @@ export default function compose(state = initialState, action) { |
|
|
|
map.set('idempotencyKey', uuid()); |
|
|
|
map.set('idempotencyKey', uuid()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
case COMPOSE_SUBMIT_REQUEST: |
|
|
|
case COMPOSE_SUBMIT_REQUEST: |
|
|
|
case COMPOSE_UPLOAD_CHANGE_REQUEST: |
|
|
|
|
|
|
|
return state.set('is_submitting', true); |
|
|
|
return state.set('is_submitting', true); |
|
|
|
|
|
|
|
case COMPOSE_UPLOAD_CHANGE_REQUEST: |
|
|
|
|
|
|
|
return state.set('is_changing_upload', true); |
|
|
|
case COMPOSE_SUBMIT_SUCCESS: |
|
|
|
case COMPOSE_SUBMIT_SUCCESS: |
|
|
|
return action.status && state.getIn(['advanced_options', 'threaded_mode']) ? continueThread(state, action.status) : clearAll(state); |
|
|
|
return action.status && state.getIn(['advanced_options', 'threaded_mode']) ? continueThread(state, action.status) : clearAll(state); |
|
|
|
case COMPOSE_SUBMIT_FAIL: |
|
|
|
case COMPOSE_SUBMIT_FAIL: |
|
|
|
case COMPOSE_UPLOAD_CHANGE_FAIL: |
|
|
|
|
|
|
|
return state.set('is_submitting', false); |
|
|
|
return state.set('is_submitting', false); |
|
|
|
|
|
|
|
case COMPOSE_UPLOAD_CHANGE_FAIL: |
|
|
|
|
|
|
|
return state.set('is_changing_upload', false); |
|
|
|
case COMPOSE_UPLOAD_REQUEST: |
|
|
|
case COMPOSE_UPLOAD_REQUEST: |
|
|
|
return state.set('is_uploading', true); |
|
|
|
return state.set('is_uploading', true); |
|
|
|
case COMPOSE_UPLOAD_SUCCESS: |
|
|
|
case COMPOSE_UPLOAD_SUCCESS: |
|
|
@ -393,7 +397,7 @@ export default function compose(state = initialState, action) { |
|
|
|
return insertEmoji(state, action.position, action.emoji); |
|
|
|
return insertEmoji(state, action.position, action.emoji); |
|
|
|
case COMPOSE_UPLOAD_CHANGE_SUCCESS: |
|
|
|
case COMPOSE_UPLOAD_CHANGE_SUCCESS: |
|
|
|
return state |
|
|
|
return state |
|
|
|
.set('is_submitting', false) |
|
|
|
.set('is_changing_upload', false) |
|
|
|
.update('media_attachments', list => list.map(item => { |
|
|
|
.update('media_attachments', list => list.map(item => { |
|
|
|
if (item.get('id') === action.media.id) { |
|
|
|
if (item.get('id') === action.media.id) { |
|
|
|
return fromJS(action.media); |
|
|
|
return fromJS(action.media); |
|
|
|