fixes, guards
This commit is contained in:
parent
790fcf37d2
commit
fd27c78c4b
@ -300,7 +300,7 @@ export const mutations = {
|
|||||||
},
|
},
|
||||||
clearTimeline (state, { timeline }) {
|
clearTimeline (state, { timeline }) {
|
||||||
const timelineObject = typeof timeline === 'object' ? timeline : state.timelines[timeline]
|
const timelineObject = typeof timeline === 'object' ? timeline : state.timelines[timeline]
|
||||||
emptyTl(timelineObject, state.timelines[timeline].userId)
|
emptyTl(timelineObject, timeline.userId)
|
||||||
},
|
},
|
||||||
setFavorited (state, { status, value }) {
|
setFavorited (state, { status, value }) {
|
||||||
const newStatus = state.allStatusesObject[status.id]
|
const newStatus = state.allStatusesObject[status.id]
|
||||||
|
@ -277,6 +277,12 @@ const fetchConversation = ({id, credentials}) => {
|
|||||||
let url = `${CONVERSATION_URL}/${id}.json?count=100`
|
let url = `${CONVERSATION_URL}/${id}.json?count=100`
|
||||||
return fetch(url, { headers: authHeaders(credentials) })
|
return fetch(url, { headers: authHeaders(credentials) })
|
||||||
.then((data) => data.json())
|
.then((data) => data.json())
|
||||||
|
.then((data) => {
|
||||||
|
if (data.ok) {
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
throw new Error('Error fetching timeline')
|
||||||
|
})
|
||||||
.then((data) => data.map(parseStatus))
|
.then((data) => data.map(parseStatus))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +290,13 @@ const fetchStatus = ({id, credentials}) => {
|
|||||||
let url = `${STATUS_URL}/${id}.json`
|
let url = `${STATUS_URL}/${id}.json`
|
||||||
return fetch(url, { headers: authHeaders(credentials) })
|
return fetch(url, { headers: authHeaders(credentials) })
|
||||||
.then((data) => data.json())
|
.then((data) => data.json())
|
||||||
.then((data) => data.map(parseStatus))
|
.then((data) => {
|
||||||
|
if (data.ok) {
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
throw new Error('Error fetching timeline')
|
||||||
|
})
|
||||||
|
.then((data) => parseStatus(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
const setUserMute = ({id, credentials, muted = true}) => {
|
const setUserMute = ({id, credentials, muted = true}) => {
|
||||||
|
@ -117,11 +117,15 @@ export const parseStatus = (data) => {
|
|||||||
output.nsfw = data.sensitive
|
output.nsfw = data.sensitive
|
||||||
|
|
||||||
output.statusnet_html = data.content
|
output.statusnet_html = data.content
|
||||||
// Not exactly the same...
|
|
||||||
|
// Not exactly the same but works?
|
||||||
output.text = data.content
|
output.text = data.content
|
||||||
|
|
||||||
output.in_reply_to_status_id = data.in_reply_to_id
|
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_user_id
|
||||||
|
|
||||||
|
// Not exactly the same but works
|
||||||
|
output.statusnet_conversation_id = data.id
|
||||||
} else {
|
} else {
|
||||||
output.favorited = data.favorited
|
output.favorited = data.favorited
|
||||||
output.fave_num = data.fave_num
|
output.fave_num = data.fave_num
|
||||||
@ -145,6 +149,8 @@ export const parseStatus = (data) => {
|
|||||||
|
|
||||||
output.in_reply_to_status_id = data.in_reply_to_id
|
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_user_id = data.in_reply_to_account_id
|
||||||
|
|
||||||
|
output.statusnet_conversation_id = data.statusnet_conversation_id
|
||||||
}
|
}
|
||||||
|
|
||||||
output.id = Number(data.id)
|
output.id = Number(data.id)
|
||||||
|
Loading…
Reference in New Issue
Block a user