support for CW/Subject. fix replies.

This commit is contained in:
Henry Jameson 2019-01-17 23:22:51 +03:00
parent 80a7035154
commit af36f4915a
2 changed files with 12 additions and 8 deletions

View file

@ -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))

View file

@ -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)