Skip to content

Commit

Permalink
Fix media description not being cleared (#24720)
Browse files Browse the repository at this point in the history
  • Loading branch information
c960657 committed Apr 30, 2023
1 parent 274d561 commit bfeccf6
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions app/javascript/mastodon/actions/compose.js
Expand Up @@ -406,16 +406,12 @@ export function changeUploadCompose(id, params) {
// Editing already-attached media is deferred to editing the post itself.
// For simplicity's sake, fake an API reply.
if (media && !media.get('unattached')) {
let { description, focus } = params;
const data = media.toJS();

if (description) {
data.description = description;
}
const { focus, ...other } = params;
const data = { ...media.toJS(), ...other };

if (focus) {
focus = focus.split(',');
data.meta = { focus: { x: parseFloat(focus[0]), y: parseFloat(focus[1]) } };
const [x, y] = focus.split(',');
data.meta = { focus: { x: parseFloat(x), y: parseFloat(y) } };
}

dispatch(changeUploadComposeSuccess(data, true));
Expand Down

0 comments on commit bfeccf6

Please sign in to comment.