Skip to content

Commit b9014b7

Browse files
feat: update post reasons (#2784)
1 parent c64bd18 commit b9014b7

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/entity/PostReport.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class PostReport {
1515
@Column({ default: () => 'now()' })
1616
createdAt: Date;
1717

18-
@Column({ length: 12, type: 'varchar' })
18+
@Column({ length: 30, type: 'varchar' })
1919
reason: ReportReason;
2020

2121
@Column({ type: 'text', array: true, default: null })

src/entity/common.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,21 @@ export enum ReportReason {
2424
Trolling = 'TROLLING',
2525
Impersonation = 'IMPERSONATION',
2626
Plagiarism = 'PLAGIARISM',
27+
Paywall = 'PAYWALL',
2728
}
2829

2930
export const postReportReasonsMap: Map<ReportReason, string> = new Map([
31+
[ReportReason.Spam, '♻️ Spam or scam'],
32+
[ReportReason.Hateful, '📛 Hateful speech or harassment'],
33+
[ReportReason.Misinformation, '🚫 Misinformation or politically-oriented'],
34+
[ReportReason.Copyright, '©️ Plagiarism or copyright violation'],
35+
[ReportReason.Privacy, '📵 Privacy violation'],
3036
[ReportReason.Broken, '💔 Link is broken'],
3137
[ReportReason.Clickbait, '🎣 Clickbait!!!'],
3238
[ReportReason.Low, '💩 Low quality content'],
3339
[ReportReason.Nsfw, '🔞 Post is NSFW'],
3440
[ReportReason.Irrelevant, `Post's tags are irrelevant`],
41+
[ReportReason.Paywall, '🔒 Paywalled content'],
3542
[ReportReason.Other, '🤔 Other'],
3643
]);
3744

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { MigrationInterface, QueryRunner } from "typeorm";
2+
3+
export class PostReportLength1745812404446 implements MigrationInterface {
4+
name = 'PostReportLength1745812404446'
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(`ALTER TABLE "post_report" ALTER COLUMN "reason" TYPE character varying(30)`);
8+
await queryRunner.query(`ALTER TABLE "post_report" ALTER COLUMN "reason" SET NOT NULL`);
9+
}
10+
11+
public async down(queryRunner: QueryRunner): Promise<void> {
12+
await queryRunner.query(`ALTER TABLE "post_report" ALTER COLUMN "reason" TYPE character varying(12)`);
13+
await queryRunner.query(`ALTER TABLE "post_report" ALTER COLUMN "reason" SET NOT NULL`);
14+
}
15+
}

0 commit comments

Comments
 (0)