noteのread処理

This commit is contained in:
syuilo 2021-03-23 15:06:56 +09:00
parent 00bc097abb
commit 7e4a800352
10 changed files with 132 additions and 57 deletions

View file

@ -33,6 +33,7 @@ import { countSameRenotes } from '../../misc/count-same-renotes';
import { deliverToRelays } from '../relay';
import { Channel } from '../../models/entities/channel';
import { normalizeForSearch } from '../../misc/normalize-for-search';
import { getAntennas } from '../../misc/antenna-cache';
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
@ -241,6 +242,7 @@ export default async (user: User, data: Option, silent = false) => new Promise<N
incNotesCountOfUser(user);
// Word mute
// TODO: cache
UserProfiles.find({
enableWordMute: true
}).then(us => {
@ -262,17 +264,15 @@ export default async (user: User, data: Option, silent = false) => new Promise<N
Followings.createQueryBuilder('following')
.andWhere(`following.followeeId = :userId`, { userId: note.userId })
.getMany()
.then(followings => {
.then(async followings => {
const followers = followings.map(f => f.followerId);
Antennas.find().then(async antennas => {
for (const antenna of antennas) {
checkHitAntenna(antenna, note, user, followers).then(hit => {
if (hit) {
addNoteToAntenna(antenna, note, user);
}
});
}
});
for (const antenna of (await getAntennas())) {
checkHitAntenna(antenna, note, user, followers).then(hit => {
if (hit) {
addNoteToAntenna(antenna, note, user);
}
});
}
});
// Channel