アンテナに保持する最大ノート数の設定が機能していない問題を修正 (#517)

This commit is contained in:
riku6460 2024-03-11 09:23:50 +09:00 committed by GitHub
parent 67d236c201
commit 3c2eeaf16d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,7 +17,7 @@ import { UtilityService } from '@/core/UtilityService.js';
import { bindThis } from '@/decorators.js';
import type { GlobalEvents } from '@/core/GlobalEventService.js';
import { FanoutTimelineService } from '@/core/FanoutTimelineService.js';
import { RoleService } from '@/core/RoleService.js';
import { RolePolicies, RoleService } from '@/core/RoleService.js';
import type { OnApplicationShutdown } from '@nestjs/common';
@Injectable()
@ -104,9 +104,13 @@ export class AntennaService implements OnApplicationShutdown {
const redisPipeline = this.redisForTimelines.pipeline();
const { antennaNotesLimit } = await this.roleService.getUserPolicies(noteUser.id);
const policies = new Map((await Promise.allSettled(Array.from(new Set(matchedAntennas.map(antenna => antenna.userId))).map(async userId => [userId, await this.roleService.getUserPolicies(userId)] as const)))
.filter((result): result is PromiseFulfilledResult<[string, RolePolicies]> => result.status === 'fulfilled')
.map(result => result.value));
for (const antenna of matchedAntennas) {
const { antennaNotesLimit } = policies.get(antenna.userId) ?? await this.roleService.getUserPolicies(antenna.userId);
this.fanoutTimelineService.push(`antennaTimeline:${antenna.id}`, note.id, antennaNotesLimit, redisPipeline);
this.globalEventService.publishAntennaStream(antenna.id, 'note', note);
}