Skip to content
Snippets Groups Projects
Commit edf2503e authored by syuilo's avatar syuilo
Browse files

💯

parent 4d0c3036
No related branches found
No related tags found
No related merge requests found
......@@ -495,18 +495,20 @@ function incNotesCount(user: IUser) {
async function extractMentionedUsers(tokens: ReturnType<typeof parse>): Promise<IUser[]> {
if (tokens == null) return [];
// TODO: Drop dupulicates
const mentionTokens = tokens
.filter(t => t.type == 'mention') as TextElementMention[];
// TODO: Drop dupulicates
const mentionedUsers = (await Promise.all(mentionTokens.map(async m => {
try {
return await resolveUser(m.username, m.host);
} catch (e) {
return null;
}
}))).filter(x => x != null);
const mentionTokens = [...new Set(
tokens
.filter(t => t.type == 'mention') as TextElementMention[]
)];
const mentionedUsers = [...new Set(
(await Promise.all(mentionTokens.map(async m => {
try {
return await resolveUser(m.username, m.host);
} catch (e) {
return null;
}
}))).filter(x => x != null)
)];
return mentionedUsers;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment