refactor: introduce bindThis decorator to bind this automaticaly

This commit is contained in:
syuilo 2022-12-04 15:03:09 +09:00
parent e73581f715
commit bbb49457f9
199 changed files with 969 additions and 96 deletions

View file

@ -11,6 +11,7 @@ import { UtilityService } from '@/core/UtilityService.js';
import { WebfingerService } from '@/core/WebfingerService.js';
import { RemoteLoggerService } from '@/core/RemoteLoggerService.js';
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
import { bindThis } from '@/decorators.js';
@Injectable()
export class RemoteUserResolveService {
@ -31,6 +32,7 @@ export class RemoteUserResolveService {
this.logger = this.remoteLoggerService.logger.createSubLogger('resolve-user');
}
@bindThis
public async resolveUser(username: string, host: string | null): Promise<User> {
const usernameLower = username.toLowerCase();
@ -116,6 +118,7 @@ export class RemoteUserResolveService {
return user;
}
@bindThis
private async resolveSelf(acctLower: string) {
this.logger.info(`WebFinger for ${chalk.yellow(acctLower)}`);
const finger = await this.webfingerService.webfinger(acctLower).catch(err => {