fix(backend): Atomically mark remote account deletions
Some checks failed
Lint / pnpm_install (pull_request) Successful in 1m21s
Publish Docker image / Build (pull_request) Successful in 4m35s
Test (federation) / test (22.11.0) (pull_request) Failing after 1m53s
Test (production install and build) / production (22.11.0) (pull_request) Successful in 1m1s
Test (backend) / unit (22.11.0) (pull_request) Successful in 8m18s
Test (backend) / e2e (22.11.0) (pull_request) Successful in 11m32s
Lint / lint (frontend) (pull_request) Successful in 2m52s
Lint / lint (frontend-embed) (pull_request) Successful in 2m51s
Lint / lint (backend) (pull_request) Successful in 3m16s
Lint / lint (frontend-shared) (pull_request) Successful in 2m29s
Lint / lint (misskey-bubble-game) (pull_request) Successful in 2m39s
Lint / lint (misskey-js) (pull_request) Successful in 2m50s
Lint / typecheck (backend) (pull_request) Successful in 2m29s
Lint / lint (sw) (pull_request) Successful in 2m56s
Lint / lint (misskey-reversi) (pull_request) Successful in 3m23s
Lint / typecheck (misskey-js) (pull_request) Successful in 1m40s
Lint / typecheck (sw) (pull_request) Successful in 1m48s
Some checks failed
Lint / pnpm_install (pull_request) Successful in 1m21s
Publish Docker image / Build (pull_request) Successful in 4m35s
Test (federation) / test (22.11.0) (pull_request) Failing after 1m53s
Test (production install and build) / production (22.11.0) (pull_request) Successful in 1m1s
Test (backend) / unit (22.11.0) (pull_request) Successful in 8m18s
Test (backend) / e2e (22.11.0) (pull_request) Successful in 11m32s
Lint / lint (frontend) (pull_request) Successful in 2m52s
Lint / lint (frontend-embed) (pull_request) Successful in 2m51s
Lint / lint (backend) (pull_request) Successful in 3m16s
Lint / lint (frontend-shared) (pull_request) Successful in 2m29s
Lint / lint (misskey-bubble-game) (pull_request) Successful in 2m39s
Lint / lint (misskey-js) (pull_request) Successful in 2m50s
Lint / typecheck (backend) (pull_request) Successful in 2m29s
Lint / lint (sw) (pull_request) Successful in 2m56s
Lint / lint (misskey-reversi) (pull_request) Successful in 3m23s
Lint / typecheck (misskey-js) (pull_request) Successful in 1m40s
Lint / typecheck (sw) (pull_request) Successful in 1m48s
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
416d71002a
commit
c92e2d55a5
4 changed files with 78 additions and 10 deletions
59
.forgejo/workflows/test-federation.yml
Normal file
59
.forgejo/workflows/test-federation.yml
Normal file
|
@ -0,0 +1,59 @@
|
|||
name: Test (federation)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
paths:
|
||||
- packages/backend/**
|
||||
- packages/misskey-js/**
|
||||
- .forgejo/workflows/test-federation.yml
|
||||
pull_request:
|
||||
paths:
|
||||
- packages/backend/**
|
||||
- packages/misskey-js/**
|
||||
- .forgejo/workflows/test-federation.yml
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [22.11.0]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
- name: Install FFmpeg
|
||||
uses: https://github.com/FedericoCarboni/setup-ffmpeg@v3
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4.0.3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'pnpm'
|
||||
- name: Build Misskey
|
||||
run: |
|
||||
corepack enable && corepack prepare
|
||||
pnpm i --frozen-lockfile
|
||||
pnpm build
|
||||
- name: Setup
|
||||
run: |
|
||||
cd packages/backend/test-federation
|
||||
bash ./setup.sh
|
||||
chmod 644 ./certificates/*.test.key
|
||||
- name: Start servers
|
||||
# https://github.com/docker/compose/issues/1294#issuecomment-374847206
|
||||
run: |
|
||||
cd packages/backend/test-federation
|
||||
docker compose up -d --scale tester=0
|
||||
- name: Test
|
||||
run: |
|
||||
cd packages/backend/test-federation
|
||||
docker compose run --no-deps tester
|
||||
- name: Stop servers
|
||||
run: |
|
||||
cd packages/backend/test-federation
|
||||
docker compose down
|
16
packages/backend/migration/1732071810971-IndexUserDeleted.js
Normal file
16
packages/backend/migration/1732071810971-IndexUserDeleted.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project and yumechi
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
export class IndexUserDeleted1732071810971 {
|
||||
name = 'IndexUserDeleted1732071810971'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`CREATE INDEX IF NOT EXISTS "IDX_199b79e682bdc5ba946f491686" ON "user" ("isDeleted")`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`DROP INDEX IF EXISTS "IDX_199b79e682bdc5ba946f491686"`);
|
||||
}
|
||||
}
|
|
@ -509,19 +509,12 @@ export class ApInboxService {
|
|||
return `skip: delete actor ${actor.uri} !== ${uri}`;
|
||||
}
|
||||
|
||||
const user = await this.usersRepository.findOneBy({ id: actor.id });
|
||||
if (user == null) {
|
||||
return 'skip: actor not found';
|
||||
} else if (user.isDeleted) {
|
||||
if (!(await this.usersRepository.update({ id: actor.id, isDeleted: false }, { isDeleted: true })).affected) {
|
||||
return 'skip: already deleted';
|
||||
}
|
||||
|
||||
const job = await this.queueService.createDeleteAccountJob(actor);
|
||||
|
||||
await this.usersRepository.update(actor.id, {
|
||||
isDeleted: true,
|
||||
});
|
||||
|
||||
this.globalEventService.publishInternalEvent('remoteUserUpdated', { id: actor.id });
|
||||
|
||||
return `ok: queued ${job.name} ${job.id}`;
|
||||
|
|
|
@ -557,7 +557,7 @@ export class ApPersonService implements OnModuleInit {
|
|||
if (moving) updates.movedAt = new Date();
|
||||
|
||||
// Update user
|
||||
await this.usersRepository.update(exist.id, updates);
|
||||
await this.usersRepository.update({ id: exist.id, isDeleted: false }, updates);
|
||||
|
||||
if (person.publicKey) {
|
||||
await this.userPublickeysRepository.update({ userId: exist.id }, {
|
||||
|
@ -662,7 +662,7 @@ export class ApPersonService implements OnModuleInit {
|
|||
|
||||
@bindThis
|
||||
public async updateFeatured(userId: MiUser['id'], resolver?: Resolver): Promise<void> {
|
||||
const user = await this.usersRepository.findOneByOrFail({ id: userId });
|
||||
const user = await this.usersRepository.findOneByOrFail({ id: userId, isDeleted: false });
|
||||
if (!this.userEntityService.isRemoteUser(user)) return;
|
||||
if (!user.featured) return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue