From af36f4915a1a67a05a9fd98a7299889cba43d94e Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 17 Jan 2019 23:22:51 +0300 Subject: [PATCH] support for CW/Subject. fix replies. --- src/services/api/api.service.js | 10 +++++----- .../entity_normalizer/entity_normalizer.service.js | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 62d35d33..2b1ef5df 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -276,26 +276,26 @@ const fetchFollowRequests = ({credentials}) => { const fetchConversation = ({id, credentials}) => { let url = `${CONVERSATION_URL}/${id}.json?count=100` return fetch(url, { headers: authHeaders(credentials) }) - .then((data) => data.json()) .then((data) => { if (data.ok) { return data } - throw new Error('Error fetching timeline') + throw new Error('Error fetching timeline', data) }) + .then((data) => data.json()) .then((data) => data.map(parseStatus)) } const fetchStatus = ({id, credentials}) => { let url = `${STATUS_URL}/${id}.json` return fetch(url, { headers: authHeaders(credentials) }) - .then((data) => data.json()) .then((data) => { if (data.ok) { return data } - throw new Error('Error fetching timeline') + throw new Error('Error fetching timeline', data) }) + .then((data) => data.json()) .then((data) => parseStatus(data)) } @@ -355,7 +355,7 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use if (data.ok) { return data } - throw new Error('Error fetching timeline') + throw new Error('Error fetching timeline', data) }) .then((data) => data.json()) .then((data) => data.map(isNotifications ? parseNotification : parseStatus)) diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index fa35bba3..9b4905a7 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -126,7 +126,7 @@ export const parseStatus = (data) => { output.text = data.content output.in_reply_to_status_id = data.in_reply_to_id - output.in_reply_to_user_id = data.in_reply_to_user_id + output.in_reply_to_user_id = data.in_reply_to_account_id // Not exactly the same but works output.statusnet_conversation_id = data.id @@ -134,6 +134,8 @@ export const parseStatus = (data) => { if (output.type === 'retweet') { output.retweeted_status = parseStatus(data.reblog) } + + output.summary = data.spoiler_text } else { output.favorited = data.favorited output.fave_num = data.fave_num @@ -158,14 +160,16 @@ export const parseStatus = (data) => { output.statusnet_html = data.statusnet_html output.text = data.text - output.in_reply_to_status_id = data.in_reply_to_id - output.in_reply_to_user_id = data.in_reply_to_account_id + output.in_reply_to_status_id = data.in_reply_to_status_id + output.in_reply_to_user_id = data.in_reply_to_user_id output.statusnet_conversation_id = data.statusnet_conversation_id if (output.type === 'retweet') { output.retweeted_status = parseStatus(data.retweeted_status) } + + output.summary = data.summary } output.id = String(data.id)