Merge remote-tracking branch 'origin/develop' into shigusegubu-themes3
This commit is contained in:
commit
980917a16f
4 changed files with 37 additions and 19 deletions
|
|
@ -260,7 +260,12 @@ const getNodeInfo = async ({ store }) => {
|
||||||
store.dispatch('setInstanceOption', { name: 'safeDM', value: features.includes('safe_dm_mentions') })
|
store.dispatch('setInstanceOption', { name: 'safeDM', value: features.includes('safe_dm_mentions') })
|
||||||
store.dispatch('setInstanceOption', { name: 'shoutAvailable', value: features.includes('chat') })
|
store.dispatch('setInstanceOption', { name: 'shoutAvailable', value: features.includes('chat') })
|
||||||
store.dispatch('setInstanceOption', { name: 'pleromaChatMessagesAvailable', value: features.includes('pleroma_chat_messages') })
|
store.dispatch('setInstanceOption', { name: 'pleromaChatMessagesAvailable', value: features.includes('pleroma_chat_messages') })
|
||||||
store.dispatch('setInstanceOption', { name: 'pleromaCustomEmojiReactionsAvailable', value: features.includes('pleroma_custom_emoji_reactions') })
|
store.dispatch('setInstanceOption', {
|
||||||
|
name: 'pleromaCustomEmojiReactionsAvailable',
|
||||||
|
value:
|
||||||
|
features.includes('pleroma_custom_emoji_reactions') ||
|
||||||
|
features.includes('custom_emoji_reactions')
|
||||||
|
})
|
||||||
store.dispatch('setInstanceOption', { name: 'pleromaBookmarkFoldersAvailable', value: features.includes('pleroma:bookmark_folders') })
|
store.dispatch('setInstanceOption', { name: 'pleromaBookmarkFoldersAvailable', value: features.includes('pleroma:bookmark_folders') })
|
||||||
store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: features.includes('gopher') })
|
store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: features.includes('gopher') })
|
||||||
store.dispatch('setInstanceOption', { name: 'pollsAvailable', value: features.includes('polls') })
|
store.dispatch('setInstanceOption', { name: 'pollsAvailable', value: features.includes('polls') })
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,7 @@ const defaultState = {
|
||||||
pleromaCustomEmojiReactionsAvailable: false,
|
pleromaCustomEmojiReactionsAvailable: false,
|
||||||
pleromaBookmarkFoldersAvailable: false,
|
pleromaBookmarkFoldersAvailable: false,
|
||||||
pleromaPublicFavouritesAvailable: true,
|
pleromaPublicFavouritesAvailable: true,
|
||||||
|
statusNotificationTypeAvailable: true,
|
||||||
gopherAvailable: false,
|
gopherAvailable: false,
|
||||||
mediaProxyAvailable: false,
|
mediaProxyAvailable: false,
|
||||||
suggestionsEnabled: false,
|
suggestionsEnabled: false,
|
||||||
|
|
|
||||||
|
|
@ -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])
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -5,22 +5,24 @@ import { promiseInterval } from '../promise_interval/promise_interval.js'
|
||||||
const update = ({ store, notifications, older }) => {
|
const update = ({ store, notifications, older }) => {
|
||||||
store.dispatch('addNewNotifications', { notifications, older })
|
store.dispatch('addNewNotifications', { notifications, older })
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// For using include_types when fetching notifications.
|
||||||
|
// Note: chat_mention excluded as pleroma-fe polls them separately
|
||||||
|
const mastoApiNotificationTypes = new Set([
|
||||||
|
'mention',
|
||||||
|
'status',
|
||||||
|
'favourite',
|
||||||
|
'reblog',
|
||||||
|
'follow',
|
||||||
|
'follow_request',
|
||||||
|
'move',
|
||||||
|
'poll',
|
||||||
|
'pleroma:emoji_reaction',
|
||||||
|
'pleroma:report',
|
||||||
|
'test'
|
||||||
|
])
|
||||||
|
|
||||||
const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
|
const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
|
||||||
// For using include_types when fetching notifications.
|
|
||||||
// Note: chat_mention excluded as pleroma-fe polls them separately
|
|
||||||
const mastoApiNotificationTypes = [
|
|
||||||
'mention',
|
|
||||||
'status',
|
|
||||||
'favourite',
|
|
||||||
'reblog',
|
|
||||||
'follow',
|
|
||||||
'follow_request',
|
|
||||||
'move',
|
|
||||||
'poll',
|
|
||||||
'pleroma:emoji_reaction',
|
|
||||||
'pleroma:report'
|
|
||||||
]
|
|
||||||
|
|
||||||
const args = { credentials }
|
const args = { credentials }
|
||||||
const { getters } = store
|
const { getters } = store
|
||||||
|
|
@ -28,8 +30,8 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
|
||||||
const timelineData = rootState.notifications
|
const timelineData = rootState.notifications
|
||||||
const hideMutedPosts = getters.mergedConfig.hideMutedPosts
|
const hideMutedPosts = getters.mergedConfig.hideMutedPosts
|
||||||
|
|
||||||
if (store.rootState.instance.pleromaChatMessagesAvailable) {
|
if (rootState.instance.pleromaChatMessagesAvailable) {
|
||||||
mastoApiNotificationTypes.push('pleroma:chat_mention')
|
mastoApiNotificationTypes.add('pleroma:chat_mention')
|
||||||
}
|
}
|
||||||
|
|
||||||
args.includeTypes = mastoApiNotificationTypes
|
args.includeTypes = mastoApiNotificationTypes
|
||||||
|
|
@ -75,7 +77,17 @@ const fetchNotifications = ({ store, args, older }) => {
|
||||||
return apiService.fetchTimeline(args)
|
return apiService.fetchTimeline(args)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
throw new Error(`${response.status} ${response.statusText}`)
|
if (response.status === 400 && response.statusText.includes('Invalid value for enum')) {
|
||||||
|
response
|
||||||
|
.statusText
|
||||||
|
.matchAll(/(\w+) - Invalid value for enum./g)
|
||||||
|
.toArray()
|
||||||
|
.map(x => x[1])
|
||||||
|
.forEach(x => mastoApiNotificationTypes.delete(x))
|
||||||
|
return fetchNotifications({ store, args, older })
|
||||||
|
} else {
|
||||||
|
throw new Error(`${response.status} ${response.statusText}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const notifications = response.data
|
const notifications = response.data
|
||||||
update({ store, notifications, older })
|
update({ store, notifications, older })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue