This commit is contained in:
Henry Jameson 2026-06-01 20:05:25 +03:00
commit caa49744b2
5 changed files with 42 additions and 39 deletions

View file

@ -11,8 +11,8 @@ import ModifiedIndicator from '../helpers/modified_indicator.vue'
import SharedComputedObject from '../helpers/shared_computed_object.js'
import StringSetting from '../helpers/string_setting.vue'
import { useInstanceStore } from 'src/stores/instance.js'
import { useEmojiStore } from 'src/stores/emoji.js'
import { useInstanceStore } from 'src/stores/instance.js'
import { useInterfaceStore } from 'src/stores/interface.js'
import { library } from '@fortawesome/fontawesome-svg-core'
@ -176,21 +176,24 @@ const EmojiTab = {
},
refreshPackList() {
useEmojiStore().getAdminPacks(
this.remotePackInstance,
this.$store.state.api.backendInteractor.listEmojiPacks,
).then((allPacks) => {
this.knownLocalPacks = allPacks
for (const name of Object.keys(this.knownLocalPacks)) {
this.sortPackFiles(name)
}
})
useEmojiStore()
.getAdminPacks(
this.remotePackInstance,
this.$store.state.api.backendInteractor.listEmojiPacks,
)
.then((allPacks) => {
this.knownLocalPacks = allPacks
for (const name of Object.keys(this.knownLocalPacks)) {
this.sortPackFiles(name)
}
})
},
listRemotePacks() {
useEmojiStore().getAdminPacks(
this.remotePackInstance,
this.$store.state.api.backendInteractor.listRemoteEmojiPacks,
)
useEmojiStore()
.getAdminPacks(
this.remotePackInstance,
this.$store.state.api.backendInteractor.listRemoteEmojiPacks,
)
.then((allPacks) => {
let inst = this.remotePackInstance
if (!inst.startsWith('http')) {

View file

@ -14,8 +14,8 @@ import {
import {
faBookmark,
faCheck,
faChevronRight,
faChevronDown,
faChevronRight,
faExternalLinkAlt,
faEyeSlash,
faHistory,

View file

@ -1,11 +1,11 @@
import Popover from 'components/popover/popover.vue'
import SelectComponent from 'components/select/select.vue'
import StillImage from './still-image.vue'
import { mapState } from 'pinia'
import { useInterfaceStore } from 'src/stores/interface'
import StillImage from './still-image.vue'
import { useEmojiStore } from 'src/stores/emoji'
import { useInterfaceStore } from 'src/stores/interface'
export default {
components: { StillImage, Popover, SelectComponent },
@ -28,7 +28,7 @@ export default {
isUserAdmin() {
return this.$store.state.users.currentUser?.rights.admin
},
...mapState(useEmojiStore, ['adminPacksLocal', 'adminPacksLocalLoading'])
...mapState(useEmojiStore, ['adminPacksLocal', 'adminPacksLocalLoading']),
},
methods: {
displayError(msg) {
@ -64,9 +64,11 @@ export default {
},
fetchEmojiPacksIfAdmin() {
useEmojiStore().getAdminPacksLocal().then(() => {
this.$refs.emojiPopover.updateStyles()
})
useEmojiStore()
.getAdminPacksLocal()
.then(() => {
this.$refs.emojiPopover.updateStyles()
})
},
},
}

View file

@ -3,8 +3,8 @@ import { defineAsyncComponent } from 'vue'
import RichContent from 'src/components/rich_content/rich_content.jsx'
import UnicodeDomainIndicator from '../unicode_domain_indicator/unicode_domain_indicator.vue'
import { useMergedConfigStore } from 'src/stores/merged_config.js'
import { useInstanceStore } from 'src/stores/instance.js'
import { useMergedConfigStore } from 'src/stores/merged_config.js'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
@ -40,7 +40,7 @@ const UserListPopover = {
useInstanceStore().restrictedNicknames,
)
},
}
},
}
export default UserListPopover

View file

@ -1,6 +1,6 @@
import { merge } from 'lodash'
import { defineStore } from 'pinia'
import { merge } from 'lodash'
import { useInstanceStore } from 'src/stores/instance.js'
import { ensureFinalFallback } from 'src/i18n/languages.js'
@ -187,7 +187,10 @@ export const useEmojiStore = defineStore('emoji', {
const listFunction = backendInteractor.listEmojiPacks
this.adminPacksLocalLoading = true
this.adminPacksLocal = await this.getAdminPacks(useInstanceStore().server, listFunction)
this.adminPacksLocal = await this.getAdminPacks(
useInstanceStore().server,
listFunction,
)
this.adminPacksLocalLoading = false
},
@ -197,8 +200,6 @@ export const useEmojiStore = defineStore('emoji', {
if (!currentUser.rights.admin) return
const pageSize = 25
const allPacks = {}
return await listFunction({
instance,
@ -222,25 +223,22 @@ export const useEmojiStore = defineStore('emoji', {
})
.then((data) => data.json())
.then((pageData) => {
if (pageData.error !== undefined) {
return Promise.reject(pageData.error)
}
if (pageData.error !== undefined) {
return Promise.reject(pageData.error)
}
return pageData.packs
})
}),
)
}
return Promise
.all(promises)
.then((results) => {
return merge({}, ...results)
})
return Promise.all(promises).then((results) => {
return merge({}, ...results)
})
})
.then((allPacks) => {
// Sort by key
return Object
.keys(allPacks)
return Object.keys(allPacks)
.sort()
.reduce((acc, key) => {
if (key.length === 0) return acc