Merge branch 'akkoma-support-part-2' into 'develop'
better error handling See merge request pleroma/pleroma-fe!2193
This commit is contained in:
commit
d72438f0a7
2 changed files with 8 additions and 11 deletions
|
|
@ -759,7 +759,7 @@ const fetchTimeline = ({
|
||||||
if (replyVisibility !== 'all') {
|
if (replyVisibility !== 'all') {
|
||||||
params.push(['reply_visibility', replyVisibility])
|
params.push(['reply_visibility', replyVisibility])
|
||||||
}
|
}
|
||||||
if (includeTypes.length > 0) {
|
if (includeTypes.size > 0) {
|
||||||
includeTypes.forEach(type => {
|
includeTypes.forEach(type => {
|
||||||
params.push(['include_types[]', type])
|
params.push(['include_types[]', type])
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,6 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
|
||||||
mastoApiNotificationTypes.add('pleroma:chat_mention')
|
mastoApiNotificationTypes.add('pleroma:chat_mention')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rootState.instance.statusNotificationTypeAvailable) {
|
|
||||||
mastoApiNotificationTypes.delete('status')
|
|
||||||
}
|
|
||||||
|
|
||||||
args.includeTypes = mastoApiNotificationTypes
|
args.includeTypes = mastoApiNotificationTypes
|
||||||
args.withMuted = !hideMutedPosts
|
args.withMuted = !hideMutedPosts
|
||||||
|
|
||||||
|
|
@ -81,12 +77,13 @@ const fetchNotifications = ({ store, args, older }) => {
|
||||||
return apiService.fetchTimeline(args)
|
return apiService.fetchTimeline(args)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
if (response.status === 400 && mastoApiNotificationTypes.has('status')) {
|
if (response.status === 400 && response.statusText.includes('Invalid value for enum')) {
|
||||||
store.dispatch('setInstanceOption', {
|
response
|
||||||
name: 'statusNotificationTypeAvailable',
|
.statusText
|
||||||
value: false
|
.matchAll(/(\w+) - Invalid value for enum./g)
|
||||||
})
|
.toArray()
|
||||||
mastoApiNotificationTypes.delete('status')
|
.map(x => x[1])
|
||||||
|
.forEach(x => mastoApiNotificationTypes.delete(x))
|
||||||
return fetchNotifications({ store, args, older })
|
return fetchNotifications({ store, args, older })
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`${response.status} ${response.statusText}`)
|
throw new Error(`${response.status} ${response.statusText}`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue