diff --git a/src/entity/PostReport.ts b/src/entity/PostReport.ts index 200e8ff354..52c4c337d3 100644 --- a/src/entity/PostReport.ts +++ b/src/entity/PostReport.ts @@ -15,7 +15,7 @@ export class PostReport { @Column({ default: () => 'now()' }) createdAt: Date; - @Column({ length: 12, type: 'varchar' }) + @Column({ length: 30, type: 'varchar' }) reason: ReportReason; @Column({ type: 'text', array: true, default: null }) diff --git a/src/entity/common.ts b/src/entity/common.ts index 0c54b43080..3bf01a9a91 100644 --- a/src/entity/common.ts +++ b/src/entity/common.ts @@ -24,14 +24,21 @@ export enum ReportReason { Trolling = 'TROLLING', Impersonation = 'IMPERSONATION', Plagiarism = 'PLAGIARISM', + Paywall = 'PAYWALL', } export const postReportReasonsMap: Map = new Map([ + [ReportReason.Spam, 'â™ģī¸ Spam or scam'], + [ReportReason.Hateful, '📛 Hateful speech or harassment'], + [ReportReason.Misinformation, 'đŸšĢ Misinformation or politically-oriented'], + [ReportReason.Copyright, 'ÂŠī¸ Plagiarism or copyright violation'], + [ReportReason.Privacy, 'đŸ“ĩ Privacy violation'], [ReportReason.Broken, '💔 Link is broken'], [ReportReason.Clickbait, 'đŸŽŖ Clickbait!!!'], [ReportReason.Low, '💩 Low quality content'], [ReportReason.Nsfw, '🔞 Post is NSFW'], [ReportReason.Irrelevant, `Post's tags are irrelevant`], + [ReportReason.Paywall, '🔒 Paywalled content'], [ReportReason.Other, '🤔 Other'], ]); diff --git a/src/migration/1745812404446-PostReportLength.ts b/src/migration/1745812404446-PostReportLength.ts new file mode 100644 index 0000000000..ca7b23241f --- /dev/null +++ b/src/migration/1745812404446-PostReportLength.ts @@ -0,0 +1,15 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class PostReportLength1745812404446 implements MigrationInterface { + name = 'PostReportLength1745812404446' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "post_report" ALTER COLUMN "reason" TYPE character varying(30)`); + await queryRunner.query(`ALTER TABLE "post_report" ALTER COLUMN "reason" SET NOT NULL`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "post_report" ALTER COLUMN "reason" TYPE character varying(12)`); + await queryRunner.query(`ALTER TABLE "post_report" ALTER COLUMN "reason" SET NOT NULL`); + } +}