implement note mutings and move favorited/renoted status into note entity directly

This commit is contained in:
Hazelnoot 2025-06-10 00:46:52 -04:00
parent 9bebf7718f
commit 7200c3d6c8
24 changed files with 342 additions and 181 deletions

View file

@ -8,7 +8,7 @@ import { id } from './util/id.js';
import { MiUser } from './User.js';
@Entity('note_thread_muting')
@Index(['userId', 'threadId'], { unique: true })
@Index(['userId', 'threadId', 'isPostMute'], { unique: true })
export class MiNoteThreadMuting {
@PrimaryColumn(id())
public id: string;
@ -30,4 +30,10 @@ export class MiNoteThreadMuting {
length: 256,
})
public threadId: string;
@Column('boolean', {
comment: 'If true, then this mute applies only to the referenced note. If false (default), then it applies to all replies as well.',
default: false,
})
public isPostMute: boolean;
}

View file

@ -173,7 +173,19 @@ export const packedNoteSchema = {
},
},
},
isMuting: {
isMutingThread: {
type: 'boolean',
optional: false, nullable: false,
},
isMutingNote: {
type: 'boolean',
optional: false, nullable: false,
},
isFavorited: {
type: 'boolean',
optional: false, nullable: false,
},
isRenoted: {
type: 'boolean',
optional: false, nullable: false,
},