From de1ebc99a7788ab5767e3e803067dec8921f2a39 Mon Sep 17 00:00:00 2001 From: Rory& Date: Sun, 7 Dec 2025 22:32:37 +0100 Subject: [PATCH] Perhaps, dont IP ban moderators --- assets/openapi.json | Bin 856644 -> 856618 bytes assets/schemas.json | Bin 380358 -> 380340 bytes src/api/routes/guilds/#guild_id/bans.ts | 1 - src/util/entities/Ban.ts | 4 ++-- .../postgres/1765143034407-DontIpBanBanner.ts | 16 ++++++++++++++++ 5 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 src/util/migration/postgres/1765143034407-DontIpBanBanner.ts diff --git a/assets/openapi.json b/assets/openapi.json index ee7a4e8a56ec1352e9da43f6501f03d560444d36..e502af61c79f8dbc67f1737ccd1347040b5b01a3 100644 GIT binary patch delta 95 zcmX@I#AMYHlZFFEi4-jOcw}Y4W2H4o{4R`x-DzWbb%t4_~{LCObOEiOqr~w qFYsqInl8Y_a<#qTFbfc~0x=s9vjZ^)5OV@C7Z7uAZ#c|z#18FEi4-jOkaPHO{#sv0Tv);1!6WJW(Q&pAm#*OE+FRKzTp5* GRUiOUP8@Oo diff --git a/assets/schemas.json b/assets/schemas.json index 576a9c608ded6236737421a1aa14010c4d3104e7..d5b4835ef2fae21b650726a5e2eeeec4a12d1736 100644 GIT binary patch delta 36 scmX>$TYSrG@rD-07N!>FEi7l4CohO$oxb4-b56TI3(IzY7S{5U01Mp>(*OVf delta 46 zcmV+}0MY-nn-|8L7l4ETgaU*Ev;@opm%p_I5|f}@1(&eo18kSRJOKuWLj(l3Lj(nJ E$+CJ8ZvX%Q diff --git a/src/api/routes/guilds/#guild_id/bans.ts b/src/api/routes/guilds/#guild_id/bans.ts index e253bef9f..1274c195d 100644 --- a/src/api/routes/guilds/#guild_id/bans.ts +++ b/src/api/routes/guilds/#guild_id/bans.ts @@ -215,7 +215,6 @@ router.put( const ban = Ban.create({ user_id: banned_user_id, guild_id: guild_id, - ip: getIpAdress(req), executor_id: req.user_id, reason: req.body.reason, // || otherwise empty }); diff --git a/src/util/entities/Ban.ts b/src/util/entities/Ban.ts index d4a7bc1c3..c3c473f47 100644 --- a/src/util/entities/Ban.ts +++ b/src/util/entities/Ban.ts @@ -53,8 +53,8 @@ export class Ban extends BaseClass { @ManyToOne(() => User) executor: User; - @Column() - ip: string; + @Column({ nullable: true }) + ip?: string; @Column({ nullable: true }) reason?: string; diff --git a/src/util/migration/postgres/1765143034407-DontIpBanBanner.ts b/src/util/migration/postgres/1765143034407-DontIpBanBanner.ts new file mode 100644 index 000000000..6e8089efe --- /dev/null +++ b/src/util/migration/postgres/1765143034407-DontIpBanBanner.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class DontIpBanBanner1765143034407 implements MigrationInterface { + name = 'DontIpBanBanner1765143034407' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "bans" ALTER COLUMN "ip" DROP NOT NULL`); + await queryRunner.query(`UPDATE "bans" SET "ip" = NULL`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`UPDATE "bans" SET "ip" = '0.0.0.0' WHERE "ip" IS NULL`); + await queryRunner.query(`ALTER TABLE "bans" ALTER COLUMN "ip" SET NOT NULL`); + } + +}