turns out announcements require login
This commit is contained in:
parent
ecfea5c5e3
commit
d9d50de3f6
5 changed files with 21 additions and 19 deletions
|
|
@ -91,6 +91,7 @@ export const getClientToken = ({ clientId, clientSecret, instance }) => {
|
|||
formData,
|
||||
})
|
||||
}
|
||||
|
||||
export const verifyOTPCode = ({ app, instance, mfaToken, code }) => {
|
||||
const formData = new window.FormData()
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ const MASTODON_MUTE_CONVERSATION = (id) => `/api/v1/statuses/${id}/mute`
|
|||
const MASTODON_UNMUTE_CONVERSATION = (id) => `/api/v1/statuses/${id}/unmute`
|
||||
const MASTODON_DOMAIN_BLOCKS_URL = '/api/v1/domain_blocks'
|
||||
const MASTODON_LISTS_URL = '/api/v1/lists'
|
||||
const MASTODON_ANNOUNCEMENTS_URL = '/api/v1/announcements'
|
||||
const MASTODON_ANNOUNCEMENTS_DISMISS_URL = (id) =>
|
||||
`/api/v1/announcements/${id}/dismiss`
|
||||
const PLEROMA_EMOJI_REACT_URL = (id, emoji) =>
|
||||
|
|
@ -335,13 +336,6 @@ export const dismissNotification = ({ credentials, id }) =>
|
|||
credentials,
|
||||
})
|
||||
|
||||
export const dismissAnnouncement = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_ANNOUNCEMENTS_DISMISS_URL(id),
|
||||
credentials,
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
export const markNotificationsAsSeen = ({
|
||||
id,
|
||||
credentials,
|
||||
|
|
@ -363,6 +357,18 @@ export const markNotificationsAsSeen = ({
|
|||
})
|
||||
}
|
||||
|
||||
// #Announcements
|
||||
export const getAnnouncements = ({ credentials }) =>
|
||||
promisedRequest({ url: MASTODON_ANNOUNCEMENTS_URL, credentials })
|
||||
|
||||
export const dismissAnnouncement = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_ANNOUNCEMENTS_DISMISS_URL(id),
|
||||
credentials,
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
|
||||
// #Imports
|
||||
export const importMutes = ({ file, credentials }) => {
|
||||
const formData = new FormData()
|
||||
|
|
|
|||
|
|
@ -566,10 +566,6 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
|
|||
getInstanceConfig({ store }),
|
||||
]).catch((e) => Promise.reject(e))
|
||||
|
||||
// Start fetching things that don't need to block the UI
|
||||
store.dispatch('fetchMutes')
|
||||
store.dispatch('loadDrafts')
|
||||
useAnnouncementsStore().startFetchingAnnouncements()
|
||||
getTOS({ store })
|
||||
getStickers({ store })
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
|||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||
|
||||
import { revokeToken } from 'src/api/oauth.js'
|
||||
import {
|
||||
|
|
@ -832,8 +833,11 @@ const users = {
|
|||
startPolling()
|
||||
}
|
||||
|
||||
// Get user mutes
|
||||
// Start fetching things that don't need to block the UI
|
||||
useAnnouncementsStore().startFetchingAnnouncements()
|
||||
|
||||
dispatch('fetchMutes')
|
||||
dispatch('loadDrafts')
|
||||
|
||||
useInterfaceStore().setLayoutWidth(windowWidth())
|
||||
useInterfaceStore().setLayoutHeight(windowHeight())
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
|
|||
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { getAnnouncements } from 'src/api/public.js'
|
||||
import { getAnnouncements, dismissAnnouncement } from 'src/api/user.js'
|
||||
|
||||
const FETCH_ANNOUNCEMENT_INTERVAL_MS = 1000 * 60 * 5
|
||||
|
||||
|
|
@ -36,10 +36,6 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
currentUser.privileges.has('announcements_manage_announcements')
|
||||
|
||||
try {
|
||||
if (currentUser) {
|
||||
this.userActions = await import('src/api/user.js')
|
||||
}
|
||||
|
||||
if (isAdmin) {
|
||||
this.adminActions = await import('src/api/admin.js')
|
||||
} else {
|
||||
|
|
@ -86,8 +82,7 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
}
|
||||
},
|
||||
markAnnouncementAsRead(id) {
|
||||
return this.userActions
|
||||
.dismissAnnouncement({
|
||||
return dismissAnnouncement({
|
||||
id,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue