Remove text requirement when media attached from statuses (#6672)

This commit is contained in:
Eugen Rochko
2018-03-07 08:28:52 +01:00
committed by GitHub
parent e26d5ca923
commit cfa9b6e13a
8 changed files with 28 additions and 18 deletions

View File

@ -90,7 +90,6 @@ function appendMedia(state, media) {
map.update('media_attachments', list => list.push(media));
map.set('is_uploading', false);
map.set('resetFileKey', Math.floor((Math.random() * 0x10000)));
map.update('text', oldText => `${oldText.trim()} ${media.get('text_url')}`);
map.set('focusDate', new Date());
map.set('idempotencyKey', uuid());
@ -101,12 +100,10 @@ function appendMedia(state, media) {
};
function removeMedia(state, mediaId) {
const media = state.get('media_attachments').find(item => item.get('id') === mediaId);
const prevSize = state.get('media_attachments').size;
return state.withMutations(map => {
map.update('media_attachments', list => list.filterNot(item => item.get('id') === mediaId));
map.update('text', text => text.replace(media.get('text_url'), '').trim());
map.set('idempotencyKey', uuid());
if (prevSize === 1) {