Clean up
This commit is contained in:
parent
65961bc15b
commit
3abe632f06
2 changed files with 4 additions and 12 deletions
|
@ -1,6 +0,0 @@
|
||||||
import parse from '../../../mfm/parse';
|
|
||||||
|
|
||||||
export default function(text: string) {
|
|
||||||
if (!text) return [];
|
|
||||||
return parse(text).filter(t => t.type === 'emoji' && t.name).map(t => (t as any).name);
|
|
||||||
}
|
|
|
@ -138,12 +138,10 @@ async function getEmojis(names: string[]): Promise<IEmoji[]> {
|
||||||
if (names == null || names.length < 1) return [];
|
if (names == null || names.length < 1) return [];
|
||||||
|
|
||||||
const emojis = await Promise.all(
|
const emojis = await Promise.all(
|
||||||
names.map(async name => {
|
names.map(name => Emoji.findOne({
|
||||||
return await Emoji.findOne({
|
name,
|
||||||
name,
|
host: null
|
||||||
host: null
|
}))
|
||||||
});
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return emojis.filter(emoji => emoji != null);
|
return emojis.filter(emoji => emoji != null);
|
||||||
|
|
Loading…
Reference in a new issue