mirror of
https://github.com/hotomoe/hotomoe
synced 2024-12-02 16:58:11 +09:00
✌️
This commit is contained in:
parent
4cd70df7f4
commit
f2a9194c79
@ -6,6 +6,7 @@ import * as Misskey from 'misskey-js';
|
||||
const storageCache = miLocalStorage.getItem('emojis');
|
||||
export const customEmojis = shallowRef<Misskey.entities.CustomEmoji[]>(storageCache ? JSON.parse(storageCache) : []);
|
||||
|
||||
fetchCustomEmojis();
|
||||
window.setInterval(fetchCustomEmojis, 1000 * 60 * 10);
|
||||
|
||||
export async function fetchCustomEmojis() {
|
||||
|
@ -79,7 +79,7 @@ import { selectFile, selectFiles } from '@/scripts/select-file';
|
||||
import * as os from '@/os';
|
||||
import { i18n } from '@/i18n';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||
import { fetchCustomEmojis } from '@/custom-emojis';
|
||||
import { fetchCustomEmojis, customEmojis } from '@/custom-emojis';
|
||||
|
||||
const emojisPaginationComponent = shallowRef<InstanceType<typeof MkPagination>>();
|
||||
|
||||
@ -146,10 +146,27 @@ const edit = (emoji) => {
|
||||
...oldEmoji,
|
||||
...result.updated,
|
||||
}));
|
||||
|
||||
if (customEmojis.value.some(e => e.name === emoji.name)) {
|
||||
customEmojis.value = [
|
||||
{
|
||||
name: result.updated.name,
|
||||
aliases: result.updated.aliases,
|
||||
category: result.updated.category,
|
||||
},
|
||||
...customEmojis.value,
|
||||
];
|
||||
} else {
|
||||
customEmojis.value = customEmojis.value.map(e => e.name !== emoji.name ? e : {
|
||||
name: result.updated.name,
|
||||
aliases: result.updated.aliases,
|
||||
category: result.updated.category,
|
||||
});
|
||||
}
|
||||
} else if (result.deleted) {
|
||||
emojisPaginationComponent.value.removeItem((item) => item.id === emoji.id);
|
||||
customEmojis.value = customEmojis.value.filter(e => e.name !== emoji.name);
|
||||
}
|
||||
fetchCustomEmojis();
|
||||
},
|
||||
}, 'closed');
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user