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