ignore instance.actor
when checking if there are local users (#13146)
* ignore `instance.actor` when checking if there are local users We've seen this happen a few times: * there was some AP software at $some_domain * it gets replaced by Misskey * before the first user can be created, an AP activity comes in * Misskey resolves the activity * to do this, it creates the `instance.actor` to sign its request * now there *is* a local user, so the `meta` endpoint returns `requireSetup:false` * the admin is very confused This commit factors out the check, and doesn't count the `instance.actor` as a real user. * autogen bits
This commit is contained in:
parent
2c4ba4723f
commit
bafef1f8b4
9 changed files with 25 additions and 18 deletions
|
@ -16,6 +16,7 @@ import { MiUserKeypair } from '@/models/UserKeypair.js';
|
|||
import { MiUsedUsername } from '@/models/UsedUsername.js';
|
||||
import generateUserToken from '@/misc/generate-native-user-token.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { InstanceActorService } from '@/core/InstanceActorService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import UsersChart from '@/core/chart/charts/users.js';
|
||||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
|
@ -37,6 +38,7 @@ export class SignupService {
|
|||
private userEntityService: UserEntityService,
|
||||
private idService: IdService,
|
||||
private metaService: MetaService,
|
||||
private instanceActorService: InstanceActorService,
|
||||
private usersChart: UsersChart,
|
||||
) {
|
||||
}
|
||||
|
@ -81,7 +83,7 @@ export class SignupService {
|
|||
throw new Error('USED_USERNAME');
|
||||
}
|
||||
|
||||
const isTheFirstUser = (await this.usersRepository.countBy({ host: IsNull() })) === 0;
|
||||
const isTheFirstUser = !await this.instanceActorService.realLocalUsersPresent();
|
||||
|
||||
if (!opts.ignorePreservedUsernames && !isTheFirstUser) {
|
||||
const instance = await this.metaService.fetch(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue