Skip to content

Commit

Permalink
fix: pass current user into InstanceEntityService.packMany
Browse files Browse the repository at this point in the history
  • Loading branch information
warriordog committed Aug 1, 2024
1 parent c344705 commit 858ba18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/backend/src/core/entities/InstanceEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ export class InstanceEntityService {
@bindThis
public packMany(
instances: MiInstance[],
me?: { id: MiUser['id']; } | null | undefined,
) {
return Promise.all(instances.map(x => this.pack(x)));
return Promise.all(instances.map(x => this.pack(x, me)));
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-

const instances = await query.limit(ps.limit).offset(ps.offset).getMany();

return await this.instanceEntityService.packMany(instances);
return await this.instanceEntityService.packMany(instances, me);
});
}
}
4 changes: 2 additions & 2 deletions packages/backend/src/server/api/endpoints/federation/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const gotPubCount = topPubInstances.map(x => x.followingCount).reduce((a, b) => a + b, 0);

return await awaitAll({
topSubInstances: this.instanceEntityService.packMany(topSubInstances),
topSubInstances: this.instanceEntityService.packMany(topSubInstances, me),
otherFollowersCount: Math.max(0, allSubCount - gotSubCount),
topPubInstances: this.instanceEntityService.packMany(topPubInstances),
topPubInstances: this.instanceEntityService.packMany(topPubInstances, me),
otherFollowingCount: Math.max(0, allPubCount - gotPubCount),
});
});
Expand Down

0 comments on commit 858ba18

Please sign in to comment.