diff --git a/src/components/settings_modal/admin_tabs/emoji_tab.js b/src/components/settings_modal/admin_tabs/emoji_tab.js index 115ef519b..6afd0be5c 100644 --- a/src/components/settings_modal/admin_tabs/emoji_tab.js +++ b/src/components/settings_modal/admin_tabs/emoji_tab.js @@ -12,6 +12,7 @@ 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 { useInterfaceStore } from 'src/stores/interface.js' import { library } from '@fortawesome/fontawesome-svg-core' @@ -174,51 +175,9 @@ const EmojiTab = { this.sortPackFiles(packName) }, - loadPacksPaginated(listFunction) { - const pageSize = 25 - const allPacks = {} - - return listFunction({ - instance: this.remotePackInstance, - page: 1, - pageSize: 0, - }) - .then((data) => data.json()) - .then((data) => { - if (data.error !== undefined) { - return Promise.reject(data.error) - } - - let resultingPromise = Promise.resolve({}) - for (let i = 0; i < Math.ceil(data.count / pageSize); i++) { - resultingPromise = resultingPromise - .then(() => - listFunction({ - instance: this.remotePackInstance, - page: i, - pageSize, - }), - ) - .then((data) => data.json()) - .then((pageData) => { - if (pageData.error !== undefined) { - return Promise.reject(pageData.error) - } - - assign(allPacks, pageData.packs) - }) - } - - return resultingPromise - }) - .then(() => allPacks) - .catch((data) => { - this.displayError(data) - }) - }, - refreshPackList() { - this.loadPacksPaginated( + useEmojiStore().getAdminPacks( + this.remotePackInstance, this.$store.state.api.backendInteractor.listEmojiPacks, ).then((allPacks) => { this.knownLocalPacks = allPacks @@ -228,7 +187,8 @@ const EmojiTab = { }) }, listRemotePacks() { - this.loadPacksPaginated( + useEmojiStore().getAdminPacks( + this.remotePackInstance, this.$store.state.api.backendInteractor.listRemoteEmojiPacks, ) .then((allPacks) => { diff --git a/src/components/still-image/still-image-emoji-popover.vue b/src/components/still-image/still-image-emoji-popover.vue index 4e087c094..f80f111f7 100644 --- a/src/components/still-image/still-image-emoji-popover.vue +++ b/src/components/still-image/still-image-emoji-popover.vue @@ -21,169 +21,53 @@ /> -
- + + +
+ - - - - -
+ + + +
+ - +