add column: muted types in thread

This commit is contained in:
Johann150 2022-06-20 21:02:11 +02:00
parent 26449d4944
commit 35fd970c4a
Signed by untrusted user: Johann150
GPG Key ID: 9EE6577A2A06F8F1
4 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,13 @@
export class threadMuteNotifications1655793461890 {
name = 'threadMuteNotifications1655793461890'
async up(queryRunner) {
await queryRunner.query(`CREATE TYPE "public"."note_thread_muting_mutingnotificationtypes_enum" AS ENUM('mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded')`);
await queryRunner.query(`ALTER TABLE "note_thread_muting" ADD "mutingNotificationTypes" "public"."note_thread_muting_mutingnotificationtypes_enum" array NOT NULL DEFAULT '{}'`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "note_thread_muting" DROP COLUMN "mutingNotificationTypes"`);
await queryRunner.query(`DROP TYPE "public"."note_thread_muting_mutingnotificationtypes_enum"`);
}
}

View File

@ -1,4 +1,5 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { noteNotificationTypes } from 'foundkey-js';
import { id } from '../id.js';
import { User } from './user.js';
import { Note } from './note.js';
@ -30,4 +31,11 @@ export class NoteThreadMuting {
length: 256,
})
public threadId: string;
@Column('enum', {
enum: noteNotificationTypes,
array: true,
default: [],
})
public mutingNotificationTypes: typeof notificationTypes[number][];
}

View File

@ -1,5 +1,7 @@
export const notificationTypes = ['follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app'] as const;
export const noteNotificationTypes = ['mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded'] as const;
export const mutedNoteReasons = ['word', 'manual', 'spam', 'other'] as const;
export const ffVisibility = ['public', 'followers', 'private'] as const;

View File

@ -10,6 +10,7 @@ export {
export {
permissions,
notificationTypes,
noteNotificationTypes,
mutedNoteReasons,
ffVisibility,
} from './consts.js';