Correct shortcode attr, sort names instead of emoji, success info
This commit is contained in:
parent
24c0e0e497
commit
7ff72e5ae2
2 changed files with 15 additions and 16 deletions
|
|
@ -98,13 +98,18 @@
|
|||
this.$store.state.api.backendInteractor.addNewEmojiFile({
|
||||
packName: this.packName,
|
||||
file: this.$attrs.src,
|
||||
shortcode: this.$attrs.shortcode,
|
||||
shortcode: this.shortcode,
|
||||
filename: ""
|
||||
}).then(resp => resp.json()).then(resp => {
|
||||
if (resp.error !== undefined) {
|
||||
this.displayError(resp.error)
|
||||
return
|
||||
}
|
||||
useInterfaceStore().pushGlobalNotice({
|
||||
messageKey: 'admin_dash.emoji.copied_successfully',
|
||||
messageArgs: [this.shortcode, this.packName],
|
||||
level: 'success'
|
||||
})
|
||||
|
||||
this.$refs.emojiPopover.hidePopover()
|
||||
this.packName = ''
|
||||
|
|
@ -143,21 +148,14 @@
|
|||
|
||||
this.loadPacksPaginated(this.$store.state.api.backendInteractor.listEmojiPacks)
|
||||
.then(allPacks => {
|
||||
this.knownLocalPacks = allPacks
|
||||
|
||||
for (const name of Object.keys(this.knownLocalPacks)) {
|
||||
this.sortPackFiles(name)
|
||||
}
|
||||
// Sort by key
|
||||
const sorted = Object.keys(allPacks).sort().reduce((acc, key) => {
|
||||
if (key.length === 0) return acc
|
||||
acc[key] = allPacks[key]
|
||||
return acc
|
||||
}, {})
|
||||
this.knownLocalPacks = sorted
|
||||
})
|
||||
},
|
||||
sortPackFiles (nameOfPack) {
|
||||
// Sort by key
|
||||
const sorted = Object.keys(this.knownLocalPacks[nameOfPack].files).sort().reduce((acc, key) => {
|
||||
if (key.length === 0) return acc
|
||||
acc[key] = this.knownLocalPacks[nameOfPack].files[key]
|
||||
return acc
|
||||
}, {})
|
||||
this.knownLocalPacks[nameOfPack].files = sorted
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue