acceptAcct
This commit is contained in:
parent
3561dc98cf
commit
6614c4343f
|
@ -128,10 +128,10 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
||||||
* AP Person => Misskey User in DB
|
* AP Person => Misskey User in DB
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public async getUserFromApId(value: string | IObject): Promise<MiLocalUser | MiRemoteUser | null> {
|
public async getUserFromApId(value: string | IObject, acceptAcct: boolean = false): Promise<MiLocalUser | MiRemoteUser | null> {
|
||||||
const parsed = this.parseLocalUri(value);
|
const parsed = this.parseLocalUri(value);
|
||||||
|
|
||||||
if ('acct' in parsed) {
|
if (acceptAcct && 'acct' in parsed) {
|
||||||
return await this.usersRepository.findOneBy({
|
return await this.usersRepository.findOneBy({
|
||||||
usernameLower: parsed.acct.username.toLowerCase(),
|
usernameLower: parsed.acct.username.toLowerCase(),
|
||||||
host: (parsed.acct.host == null || parsed.local) ? IsNull() : this.utilityService.toPuny(parsed.acct.host),
|
host: (parsed.acct.host == null || parsed.local) ? IsNull() : this.utilityService.toPuny(parsed.acct.host),
|
||||||
|
|
|
@ -137,7 +137,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
}
|
}
|
||||||
|
|
||||||
let local = await this.mergePack(me, ...await Promise.all([
|
let local = await this.mergePack(me, ...await Promise.all([
|
||||||
this.apDbResolverService.getUserFromApId(uri),
|
this.apDbResolverService.getUserFromApId(uri, true),
|
||||||
this.apDbResolverService.getNoteFromApId(uri),
|
this.apDbResolverService.getNoteFromApId(uri),
|
||||||
]));
|
]));
|
||||||
if (local != null) return local;
|
if (local != null) return local;
|
||||||
|
|
Loading…
Reference in New Issue