From fefcf8645f066b35496d8d8ac58149b4090e3a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Sun, 7 Jan 2024 13:33:33 +0900 Subject: [PATCH] =?UTF-8?q?chore(abuse-report):=20=E4=B8=8D=E8=A6=81?= =?UTF-8?q?=E3=81=AB=E3=81=AA=E3=81=A3=E3=81=9F=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3-abuse-user-report-category-camel-case.js | 28 ------------------- .../api/endpoints/users/report-abuse.ts | 24 +--------------- 2 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 packages/backend/migration/1703749589203-abuse-user-report-category-camel-case.js diff --git a/packages/backend/migration/1703749589203-abuse-user-report-category-camel-case.js b/packages/backend/migration/1703749589203-abuse-user-report-category-camel-case.js deleted file mode 100644 index 6d653c0027..0000000000 --- a/packages/backend/migration/1703749589203-abuse-user-report-category-camel-case.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -export class AbuseUserReportCategoryCamelCase1703749589203 { - name = 'AbuseUserReportCategoryCamelCase1703749589203' - - async up(queryRunner) { - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'personalInfoLeak' WHERE "category" = 'personalinfoleak'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'selfHarm' WHERE "category" = 'selfharm'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'criticalBreach' WHERE "category" = 'criticalbreach'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'otherBreach' WHERE "category" = 'otherbreach'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'violationRights' WHERE "category" = 'violationrights'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'violationRightsOther' WHERE "category" = 'violationrightsother'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'notLike' WHERE "category" = 'notlike'`); - } - - async down(queryRunner) { - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'personalinfoleak' WHERE "category" = 'personalInfoLeak'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'selfharm' WHERE "category" = 'selfHarm'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'criticalbreach' WHERE "category" = 'criticalBreach'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'otherbreach' WHERE "category" = 'otherBreach'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'violationrights' WHERE "category" = 'violationRights'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'violationrightsother' WHERE "category" = 'violationRightsOther'`); - await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'notlike' WHERE "category" = 'notLike'`); - } -} diff --git a/packages/backend/src/server/api/endpoints/users/report-abuse.ts b/packages/backend/src/server/api/endpoints/users/report-abuse.ts index 814a5fd623..5f966ff6a0 100644 --- a/packages/backend/src/server/api/endpoints/users/report-abuse.ts +++ b/packages/backend/src/server/api/endpoints/users/report-abuse.ts @@ -63,14 +63,6 @@ export const paramDef = { 'violationRights', 'violationRightsOther', 'other', - // for compatibility - 'personalinfoleak', - 'selfharm', - 'criticalbreach', - 'otherbreach', - 'violationrights', - 'violationrightsother', - 'notlike', ], }, }, @@ -103,20 +95,6 @@ export default class extends Endpoint { // eslint- throw new ApiError(meta.errors.cannotReportAdmin); } - // for compatibility - if (ps.category === 'notlike') { - return; - } - - const categoriesMap: Record = { - 'personalinfoleak': 'personalInfoLeak', - 'selfharm': 'selfHarm', - 'criticalbreach': 'criticalBreach', - 'otherbreach': 'otherBreach', - 'violationrights': 'violationRights', - 'violationrightsother': 'violationRightsOther', - }; - const report = await this.abuseUserReportsRepository.insert({ id: this.idService.gen(), targetUserId: user.id, @@ -124,7 +102,7 @@ export default class extends Endpoint { // eslint- reporterId: me.id, reporterHost: null, comment: ps.comment, - category: typeof categoriesMap[ps.category] === 'string' ? categoriesMap[ps.category] : ps.category, + category: ps.category, }).then(x => this.abuseUserReportsRepository.findOneByOrFail(x.identifiers[0])); this.queueService.createReportAbuseJob(report);