merge: Respect pinned note limit for remote users (resolves #780) (!750)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/750

Closes #780

Approved-by: dakkar <dakkar@thenautilus.net>
Approved-by: Tess K <me@thvxl.se>
This commit is contained in:
Hazelnoot 2024-11-21 05:26:10 +00:00
commit a150bc53ab

View file

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