aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2019-01-21 16:28:36 +0300
committerHenry Jameson <me@hjkos.com>2019-01-21 16:28:36 +0300
commit031c044297ed6286c0e6b6c1b8333ee62f8b14b8 (patch)
treee4a5fe22c2b678c1065e57cc748a036d1b269594 /src
parentd231a45644a14cae167b7b40b9a9fd5919056664 (diff)
better handling of attachments
Diffstat (limited to 'src')
-rw-r--r--src/services/entity_normalizer/entity_normalizer.service.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index 82187a75..087f789b 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -113,11 +113,22 @@ export const parseUser = (data) => {
}
const parseAttachment = (data) => {
- // TODO A little bit messy ATM but works with both APIs
- return {
- ...data,
- mimetype: data.mimetype || data.type
+ const output = {}
+ const masto = !data.hasOwnProperty('oembed')
+
+ if (masto) {
+ // Not exactly same...
+ output.mimetype = data.type
+ output.meta = data.meta // not present in BE yet
+ } else {
+ output.mimetype = data.mimetype
+ output.meta = null // missing
}
+
+ output.url = data.url
+ output.description = data.description
+
+ return output
}
export const parseStatus = (data) => {