mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
💯
This commit is contained in:
parent
6111272654
commit
ef355295e9
@ -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[];
|
||||
const mentionTokens = [...new Set(
|
||||
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 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user