Skip to content

Commit

Permalink
Fix focus point of already-attached media not saving after edit (mast…
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire authored and Jean Bertrand committed Feb 22, 2023
1 parent d33dc37 commit 83ca1ce
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions app/javascript/mastodon/actions/compose.js
Expand Up @@ -165,11 +165,19 @@ export function submitCompose(routerHistory) {
// API call.
let media_attributes;
if (statusId !== null) {
media_attributes = media.map(item => ({
id: item.get('id'),
description: item.get('description'),
focus: item.get('focus'),
}));
media_attributes = media.map(item => {
let focus;

if (item.getIn(['meta', 'focus'])) {
focus = `${item.getIn(['meta', 'focus', 'x']).toFixed(2)},${item.getIn(['meta', 'focus', 'y']).toFixed(2)}`;
}

return {
id: item.get('id'),
description: item.get('description'),
focus,
};
});
}

api(getState).request({
Expand Down

0 comments on commit 83ca1ce

Please sign in to comment.