chore: make optional params of UserFollowingService.follow() object
This commit is contained in:
parent
3bccba571b
commit
8e3e5aef28
|
|
@ -91,7 +91,14 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async follow(_follower: { id: MiUser['id'] }, _followee: { id: MiUser['id'] }, requestId?: string, silent = false): Promise<void> {
|
public async follow(
|
||||||
|
_follower: { id: MiUser['id'] },
|
||||||
|
_followee: { id: MiUser['id'] },
|
||||||
|
{ requestId, silent = false }: {
|
||||||
|
requestId?: string,
|
||||||
|
silent?: boolean,
|
||||||
|
} = {},
|
||||||
|
): Promise<void> {
|
||||||
const [follower, followee] = await Promise.all([
|
const [follower, followee] = await Promise.all([
|
||||||
this.usersRepository.findOneByOrFail({ id: _follower.id }),
|
this.usersRepository.findOneByOrFail({ id: _follower.id }),
|
||||||
this.usersRepository.findOneByOrFail({ id: _followee.id }),
|
this.usersRepository.findOneByOrFail({ id: _followee.id }),
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ export class ApInboxService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't queue because the sender may attempt again when timeout
|
// don't queue because the sender may attempt again when timeout
|
||||||
await this.userFollowingService.follow(actor, followee, activity.id);
|
await this.userFollowingService.follow(actor, followee, { requestId: activity.id });
|
||||||
return 'ok';
|
return 'ok';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,10 @@ export class RelationshipProcessorService {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async processFollow(job: Bull.Job<RelationshipJobData>): Promise<string> {
|
public async processFollow(job: Bull.Job<RelationshipJobData>): Promise<string> {
|
||||||
this.logger.info(`${job.data.from.id} is trying to follow ${job.data.to.id}`);
|
this.logger.info(`${job.data.from.id} is trying to follow ${job.data.to.id}`);
|
||||||
await this.userFollowingService.follow(job.data.from, job.data.to, job.data.requestId, job.data.silent);
|
await this.userFollowingService.follow(job.data.from, job.data.to, {
|
||||||
|
requestId: job.data.requestId,
|
||||||
|
silent: job.data.silent
|
||||||
|
});
|
||||||
return 'ok';
|
return 'ok';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue