1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-02 12:05:48 +02:00
This commit is contained in:
syuilo
2018-12-19 11:16:29 +09:00
parent 556677be7a
commit 00f979f0e6
5 changed files with 34 additions and 16 deletions

View File

@@ -29,6 +29,7 @@ import insertNoteUnread from './unread';
import registerInstance from '../register-instance';
import Instance from '../../models/instance';
import { Node } from '../../mfm/parser';
import extractMentions from '../../misc/extract-mentions';
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
@@ -665,19 +666,7 @@ function incNotesCount(user: IUser) {
async function extractMentionedUsers(user: IUser, tokens: ReturnType<typeof parse>): Promise<IUser[]> {
if (tokens == null) return [];
const mentions: any[] = [];
const extract = (tokens: Node[]) => {
for (const x of tokens.filter(x => x.name === 'mention')) {
mentions.push(x.props);
}
for (const x of tokens.filter(x => x.children)) {
extract(x.children);
}
};
// Extract hashtags
extract(tokens);
const mentions = extractMentions(tokens);
let mentionedUsers =
erase(null, await Promise.all(mentions.map(async m => {