Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/entity/PostReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
7 changes: 7 additions & 0 deletions src/entity/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ export enum ReportReason {
Trolling = 'TROLLING',
Impersonation = 'IMPERSONATION',
Plagiarism = 'PLAGIARISM',
Paywall = 'PAYWALL',
}

export const postReportReasonsMap: Map<ReportReason, string> = 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'],
]);

Expand Down
15 changes: 15 additions & 0 deletions src/migration/1745812404446-PostReportLength.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class PostReportLength1745812404446 implements MigrationInterface {
name = 'PostReportLength1745812404446'

public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
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`);
}
}
Loading