remove duplicate function from ApDbResolverService
This commit is contained in:
parent
35eecf02b3
commit
fdc1cc2368
1 changed files with 2 additions and 25 deletions
|
|
@ -75,31 +75,8 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public async getUserFromApId(value: string | IObject | [string | IObject]): Promise<MiLocalUser | MiRemoteUser | null> {
|
public async getUserFromApId(value: string | IObject | [string | IObject]): Promise<MiLocalUser | MiRemoteUser | null> {
|
||||||
const parsed = this.parseUri(value);
|
const uri = getApId(value);
|
||||||
|
return await this.apPersonService.fetchPerson(uri);
|
||||||
if (parsed.local) {
|
|
||||||
if (parsed.type !== 'users') return null;
|
|
||||||
|
|
||||||
const u = await this.cacheService.findOptionalUserById(parsed.id);
|
|
||||||
|
|
||||||
if (u == null || u.isDeleted) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return u as MiLocalUser | MiRemoteUser;
|
|
||||||
} else {
|
|
||||||
const uid = await this.apPersonService.uriPersonCache.fetchMaybe(parsed.uri);
|
|
||||||
if (uid == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const u = await this.cacheService.findOptionalUserById(uid);
|
|
||||||
if (u == null || u.isDeleted) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return u as MiLocalUser | MiRemoteUser;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue