cleanup
This commit is contained in:
parent
1aff1ac4e7
commit
c611788e77
19 changed files with 59 additions and 122 deletions
|
|
@ -17,8 +17,11 @@ const CHANGE_EMAIL_URL = '/api/pleroma/change_email'
|
|||
const CHANGE_PASSWORD_URL = '/api/pleroma/change_password'
|
||||
const MOVE_ACCOUNT_URL = '/api/pleroma/move_account'
|
||||
const ALIASES_URL = '/api/pleroma/aliases'
|
||||
const NOTIFICATION_SETTINGS_URL = ({ blockFromStrangers, hideNotificationContents }) =>
|
||||
`/api/pleroma/notification_settings${paramsString({ blockFromStrangers, hideNotificationContents })}`
|
||||
const NOTIFICATION_SETTINGS_URL = ({
|
||||
blockFromStrangers,
|
||||
hideNotificationContents,
|
||||
}) =>
|
||||
`/api/pleroma/notification_settings${paramsString({ blockFromStrangers, hideNotificationContents })}`
|
||||
export const NOTIFICATION_READ_URL = '/api/v1/pleroma/notifications/read'
|
||||
|
||||
const MFA_SETTINGS_URL = '/api/pleroma/accounts/mfa'
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import Gallery from 'src/components/gallery/gallery.vue'
|
|||
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
|
||||
import StatusContent from 'src/components/status_content/status_content.vue'
|
||||
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useStatusesStore } from 'src/stores/statuses.js'
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faPollH } from '@fortawesome/free-solid-svg-icons'
|
||||
|
|
@ -92,9 +92,11 @@ const Draft = {
|
|||
this.showingConfirmDialog = true
|
||||
},
|
||||
doAbandon() {
|
||||
useDraftsStore().abandonDraft(this.draft.id).then(() => {
|
||||
this.hideConfirmDialog()
|
||||
})
|
||||
useDraftsStore()
|
||||
.abandonDraft(this.draft.id)
|
||||
.then(() => {
|
||||
this.hideConfirmDialog()
|
||||
})
|
||||
},
|
||||
hideConfirmDialog() {
|
||||
this.showingConfirmDialog = false
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { defineAsyncComponent } from 'vue'
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
|
||||
import Draft from 'src/components/draft/draft.vue'
|
||||
import List from 'src/components/list/list.vue'
|
||||
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
|
||||
const Drafts = {
|
||||
components: {
|
||||
Draft,
|
||||
|
|
@ -27,7 +28,8 @@ const Drafts = {
|
|||
this.showingConfirmDialog = true
|
||||
},
|
||||
doAbandonAll() {
|
||||
useDraftsStore().abandonAllDrafts()
|
||||
useDraftsStore()
|
||||
.abandonAllDrafts()
|
||||
.then(() => this.hideConfirmDialog())
|
||||
},
|
||||
hideConfirmDialog() {
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import { routeTo } from 'src/components/navigation/navigation.js'
|
|||
import OptionalRouterLink from 'src/components/optional_router_link/optional_router_link.vue'
|
||||
|
||||
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||
import { useChatsStore } from 'src/stores/chats.js'
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
import { useFollowRequestsStore } from 'src/stores/follow_requests.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUsersStore } from 'src/stores/users.js'
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
import { useChatsStore } from 'src/stores/chats.js'
|
||||
import { useFollowRequestsStore } from 'src/stores/follow_requests.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faThumbtack } from '@fortawesome/free-solid-svg-icons'
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import { findOffset } from '../../services/offset_finder/offset_finder.service.j
|
|||
import genRandomSeed from '../../services/random_seed/random_seed.service.js'
|
||||
import statusPoster from '../../services/status_poster/status_poster.service.js'
|
||||
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
import { useEmojiStore } from 'src/stores/emoji.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
|
|
@ -32,7 +33,6 @@ import { useMediaViewerStore } from 'src/stores/media_viewer.js'
|
|||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUsersStore } from 'src/stores/users.js'
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
|
||||
import { pollFormToMasto } from 'src/services/poll/poll.service.js'
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import { useAdminSettingsStore } from 'src/stores/admin_settings.js'
|
|||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useProfileConfigStore } from 'src/stores/profile_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
|
@ -413,7 +413,8 @@ export default {
|
|||
hardReset() {
|
||||
switch (this.realSource) {
|
||||
case 'admin':
|
||||
return useAdminSettingsStore().resetAdminSetting({ path: this.path })
|
||||
return useAdminSettingsStore()
|
||||
.resetAdminSetting({ path: this.path })
|
||||
.then(() => {
|
||||
this.draft = this.state
|
||||
})
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.j
|
|||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useProfileConfigStore } from 'src/stores/profile_config.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUsersStore } from 'src/stores/users.js'
|
||||
|
||||
import { updateProfile } from 'src/api/user.js'
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { unseenNotifications } from '../../services/notification_utils/notificat
|
|||
|
||||
import { useAnnouncementsStore } from 'src/stores/announcements'
|
||||
import { useChatsStore } from 'src/stores/chats.js'
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
import { useFollowRequestsStore } from 'src/stores/follow_requests.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
|
|
@ -14,7 +15,6 @@ import { useInterfaceStore } from 'src/stores/interface'
|
|||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useShoutStore } from 'src/stores/shout'
|
||||
import { useUsersStore } from 'src/stores/users.js'
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
import { cloneDeep, each, get, merge, set } from 'lodash'
|
||||
import { cloneDeep, get, set } from 'lodash'
|
||||
|
||||
import { storage } from './storage.js'
|
||||
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
|
||||
let loaded = false
|
||||
|
||||
const defaultReducer = (state, paths) =>
|
||||
paths.length === 0
|
||||
? state
|
||||
|
|
@ -14,15 +10,6 @@ const defaultReducer = (state, paths) =>
|
|||
return substate
|
||||
}, {})
|
||||
|
||||
const saveImmedeatelyActions = [
|
||||
'markNotificationsAsSeen',
|
||||
'setHighlight',
|
||||
'setOption',
|
||||
'setClientData',
|
||||
'setToken',
|
||||
'clearToken',
|
||||
]
|
||||
|
||||
const defaultStorage = (() => {
|
||||
return storage
|
||||
})()
|
||||
|
|
|
|||
|
|
@ -33,10 +33,6 @@ const i18n = createI18n({
|
|||
|
||||
messages.setLanguage(i18n.global, currentLocale)
|
||||
|
||||
const persistedStateOptions = {
|
||||
paths: ['oauth', 'config'],
|
||||
}
|
||||
|
||||
;(async () => {
|
||||
const isFox = Math.floor(Math.random() * 2) > 0 ? '_fox' : ''
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
import { storage } from 'src/lib/storage.js'
|
||||
|
||||
const storageKey = 'pleroma-fe-drafts'
|
||||
|
|
@ -18,13 +19,13 @@ const storageKey = 'pleroma-fe-drafts'
|
|||
const getStorageData = async () => await storage.getItem(storageKey)
|
||||
|
||||
const saveDraftToStorage = async (draft) => {
|
||||
const currentData = await getStorageData() ?? {}
|
||||
const currentData = (await getStorageData()) ?? {}
|
||||
currentData[draft.id] = JSON.parse(JSON.stringify(draft))
|
||||
await storage.setItem(storageKey, currentData)
|
||||
}
|
||||
|
||||
const deleteDraftFromStorage = async (ids) => {
|
||||
const currentData = await getStorageData() ?? {}
|
||||
const currentData = (await getStorageData()) ?? {}
|
||||
ids.forEach((id) => {
|
||||
delete currentData[id]
|
||||
})
|
||||
|
|
@ -33,7 +34,7 @@ const deleteDraftFromStorage = async (ids) => {
|
|||
|
||||
export const useDraftsStore = defineStore('drafts', {
|
||||
state: () => ({
|
||||
drafts: new Map()
|
||||
drafts: new Map(),
|
||||
}),
|
||||
getters: {
|
||||
draftsByTypeAndRefId(state) {
|
||||
|
|
@ -71,5 +72,5 @@ export const useDraftsStore = defineStore('drafts', {
|
|||
ids.forEach((id) => this.abandonDraft(id))
|
||||
await deleteDraftFromStorage(ids)
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -97,7 +97,9 @@ export const settingsMap = {
|
|||
}
|
||||
|
||||
export const defaultState = () => ({
|
||||
config: Object.fromEntries(Object.keys(settingsMap).map((key) => [key, null]))
|
||||
config: Object.fromEntries(
|
||||
Object.keys(settingsMap).map((key) => [key, null]),
|
||||
),
|
||||
})
|
||||
|
||||
export const useProfileConfigStore = defineStore('profileConfig', {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { defineStore } from 'pinia'
|
|||
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||
import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js'
|
||||
import { useChatsStore } from 'src/stores/chats.js'
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
import { useEmojiStore } from 'src/stores/emoji.js'
|
||||
import { useFollowRequestsStore } from 'src/stores/follow_requests.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
|
|
@ -14,14 +15,13 @@ import { useListsStore } from 'src/stores/lists.js'
|
|||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useNotificationsStore } from 'src/stores/notifications.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useProfileConfigStore } from 'src/stores/profile_config.js'
|
||||
import { useShoutStore } from 'src/stores/shout.js'
|
||||
import { useStatusesStore } from 'src/stores/statuses.js'
|
||||
import { useStreamingStore } from 'src/stores/streaming.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useProfileConfigStore } from 'src/stores/profile_config.js'
|
||||
import { useTimelinesStore } from 'src/stores/timelines.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
|
||||
import { revokeToken } from 'src/api/oauth.js'
|
||||
import {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue