about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-02-19 07:11:18 +0100
committerClaire <claire.github-309c@sitedethib.com>2023-02-19 10:54:04 +0100
commit8c8358b3cf514ee4f56f6273948d36bb92c99ac1 (patch)
tree7cb58b56d28b5ea3decf3e316e31560e1006fcae /app/javascript
parent229ab559dc96f53d05600514dc9f93d1cdc006bd (diff)
[Glitch] Fix focus point of already-attached media not saving after edit
Port b2283b68388bf5ec03da1ed367566a21a5e957f2 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/flavours/glitch/actions/compose.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js
index 01f0f3666..9c0ef83df 100644
--- a/app/javascript/flavours/glitch/actions/compose.js
+++ b/app/javascript/flavours/glitch/actions/compose.js
@@ -186,11 +186,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({