merge: fix: pass current user into InstanceEntityService.packMany (!582)
				
					
				
			View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/582 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <marie@kaifa.ch>
This commit is contained in:
		
						commit
						d9c23e92fd
					
				
					 3 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -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)));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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),
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue