respect pinned note limit for remote users

This commit is contained in:
Hazelnoot 2024-11-17 09:54:47 -05:00
parent 41536480ce
commit aabb1945e8

View file

@ -731,9 +731,10 @@ export class ApPersonService implements OnModuleInit {
// Resolve and regist Notes // Resolve and regist Notes
const limit = promiseLimit<MiNote | null>(2); const limit = promiseLimit<MiNote | null>(2);
const maxPinned = (await this.roleService.getUserPolicies(user.id)).pinLimit;
const featuredNotes = await Promise.all(items const featuredNotes = await Promise.all(items
.filter(item => getApType(item) === 'Note') // TODO: Noteでなくてもいいかも .filter(item => getApType(item) === 'Note') // TODO: Noteでなくてもいいかも
.slice(0, 5) .slice(0, maxPinned)
.map(item => limit(() => this.apNoteService.resolveNote(item, { .map(item => limit(() => this.apNoteService.resolveNote(item, {
resolver: _resolver, resolver: _resolver,
sentFrom: new URL(user.uri), sentFrom: new URL(user.uri),