diff options
| author | Gianni Ceccarelli <dakkar@thenautilus.net> | 2024-02-04 11:46:28 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-04 20:46:28 +0900 |
| commit | bafef1f8b45b5117c4418f68160ea288135571c3 (patch) | |
| tree | f9cc04f687edcb14176e399e80d9942412c064b0 /packages/backend/src/core/SignupService.ts | |
| parent | fix(backend): メール配信機能が無効ならばメールを送ること... (diff) | |
| download | sharkey-bafef1f8b45b5117c4418f68160ea288135571c3.tar.gz sharkey-bafef1f8b45b5117c4418f68160ea288135571c3.tar.bz2 sharkey-bafef1f8b45b5117c4418f68160ea288135571c3.zip | |
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
Diffstat (limited to 'packages/backend/src/core/SignupService.ts')
| -rw-r--r-- | packages/backend/src/core/SignupService.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/backend/src/core/SignupService.ts b/packages/backend/src/core/SignupService.ts index b9e3ded46f..81c2b241eb 100644 --- a/packages/backend/src/core/SignupService.ts +++ b/packages/backend/src/core/SignupService.ts @@ -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); |