cleanup(backend): refactor UtilityService (MisskeyIO#858)

This commit is contained in:
あわわわとーにゅ 2024-12-28 11:39:48 +09:00 committed by GitHub
parent cb73368c83
commit ff195d4f8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 106 additions and 126 deletions

View file

@ -54,9 +54,7 @@ export class RemoteUserResolveService {
}) as MiLocalUser;
}
host = this.utilityService.toPuny(host);
if (host === this.utilityService.toPuny(this.config.host)) {
if (this.utilityService.isSelfHost(host)) {
this.logger.info(`return local user: ${usernameLower}`);
return await this.usersRepository.findOneBy({ usernameLower, host: IsNull() }).then(u => {
if (u == null) {
@ -67,6 +65,8 @@ export class RemoteUserResolveService {
}) as MiLocalUser;
}
host = this.utilityService.normalizeHost(host);
const user = await this.usersRepository.findOneBy({ usernameLower, host }) as MiRemoteUser | null;
const acctLower = `${usernameLower}@${host}`;