Skip to content

Commit

Permalink
feat: add defaultWithReplies to MiUser
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 committed Oct 16, 2023
1 parent 34d1b46 commit 9f5ab14
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/backend/migration/1697430068149-DefaultWithReplies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/

export class DefaultWithReplies1697430068149 {
name = 'DefaultWithReplies1697430068149'

async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "user" ADD "defaultWithReplies" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`COMMENT ON COLUMN "user"."defaultWithReplies" IS 'Default value of withReplies for newly followed users'`);
}

async down(queryRunner) {
await queryRunner.query(`COMMENT ON COLUMN "user"."defaultWithReplies" IS 'Default value of withReplies for newly followed users'`);
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "defaultWithReplies"`);
}
}
6 changes: 6 additions & 0 deletions packages/backend/src/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ export class MiUser {
})
public token: string | null;

@Column('boolean', {
default: false,
comment: 'Default value of withReplies for newly followed users',
})
public defaultWithReplies: boolean;

constructor(data: Partial<MiUser>) {
if (data == null) return;

Expand Down

0 comments on commit 9f5ab14

Please sign in to comment.