forked from FoundKeyGang/FoundKey
💯
This commit is contained in:
parent
4d0c303660
commit
edf2503ee5
1 changed files with 13 additions and 11 deletions
|
@ -495,18 +495,20 @@ function incNotesCount(user: IUser) {
|
||||||
async function extractMentionedUsers(tokens: ReturnType<typeof parse>): Promise<IUser[]> {
|
async function extractMentionedUsers(tokens: ReturnType<typeof parse>): Promise<IUser[]> {
|
||||||
if (tokens == null) return [];
|
if (tokens == null) return [];
|
||||||
|
|
||||||
// TODO: Drop dupulicates
|
const mentionTokens = [...new Set(
|
||||||
const mentionTokens = tokens
|
tokens
|
||||||
.filter(t => t.type == 'mention') as TextElementMention[];
|
.filter(t => t.type == 'mention') as TextElementMention[]
|
||||||
|
)];
|
||||||
|
|
||||||
// TODO: Drop dupulicates
|
const mentionedUsers = [...new Set(
|
||||||
const mentionedUsers = (await Promise.all(mentionTokens.map(async m => {
|
(await Promise.all(mentionTokens.map(async m => {
|
||||||
try {
|
try {
|
||||||
return await resolveUser(m.username, m.host);
|
return await resolveUser(m.username, m.host);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}))).filter(x => x != null);
|
}))).filter(x => x != null)
|
||||||
|
)];
|
||||||
|
|
||||||
return mentionedUsers;
|
return mentionedUsers;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue