Fix media description not being cleared (#24720)

shrike
Christian Schmidt 2023-04-30 02:29:24 +02:00 committed by GitHub
parent 274d561430
commit bfeccf6748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 8 deletions

View File

@ -406,16 +406,12 @@ export function changeUploadCompose(id, params) {
// Editing already-attached media is deferred to editing the post itself. // Editing already-attached media is deferred to editing the post itself.
// For simplicity's sake, fake an API reply. // For simplicity's sake, fake an API reply.
if (media && !media.get('unattached')) { if (media && !media.get('unattached')) {
let { description, focus } = params; const { focus, ...other } = params;
const data = media.toJS(); const data = { ...media.toJS(), ...other };
if (description) {
data.description = description;
}
if (focus) { if (focus) {
focus = focus.split(','); const [x, y] = focus.split(',');
data.meta = { focus: { x: parseFloat(focus[0]), y: parseFloat(focus[1]) } }; data.meta = { focus: { x: parseFloat(x), y: parseFloat(y) } };
} }
dispatch(changeUploadComposeSuccess(data, true)); dispatch(changeUploadComposeSuccess(data, true));