wip: is post deletable?

This commit is contained in:
オスカー、 2025-01-01 19:28:45 +09:00
parent 5c19ac788e
commit c3d05ed548
No known key found for this signature in database
GPG key ID: 139D6573F92DA9F7
4 changed files with 11 additions and 1 deletions

View file

@ -343,6 +343,7 @@ export class NoteEntityService implements OnModuleInit {
reactionEmojis: this.customEmojiService.populateEmojis(reactionEmojiNames, host), reactionEmojis: this.customEmojiService.populateEmojis(reactionEmojiNames, host),
reactionAndUserPairCache: opts.withReactionAndUserPairCache ? note.reactionAndUserPairCache : undefined, reactionAndUserPairCache: opts.withReactionAndUserPairCache ? note.reactionAndUserPairCache : undefined,
emojis: host != null ? this.customEmojiService.populateEmojis(note.emojis, host) : undefined, emojis: host != null ? this.customEmojiService.populateEmojis(note.emojis, host) : undefined,
isDeletable: note.isDeletable,
tags: note.tags.length > 0 ? note.tags : undefined, tags: note.tags.length > 0 ? note.tags : undefined,
fileIds: note.fileIds, fileIds: note.fileIds,
files: packedFiles != null ? this.packAttachedFiles(note.fileIds, packedFiles, me) : this.driveFileEntityService.packManyByIds(note.fileIds, me), files: packedFiles != null ? this.packAttachedFiles(note.fileIds, packedFiles, me) : this.driveFileEntityService.packManyByIds(note.fileIds, me),

View file

@ -193,6 +193,11 @@ export class MiNote {
}) })
public hasPoll: boolean; public hasPoll: boolean;
@Column('boolean', {
default: true,
})
public isDeletable: boolean;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),

View file

@ -255,7 +255,10 @@ export const packedNoteSchema = {
type: 'number', type: 'number',
optional: true, nullable: false, optional: true, nullable: false,
}, },
isDeletable: {
type: 'boolean',
optional: false, nullable: false,
},
myReaction: { myReaction: {
type: 'string', type: 'string',
optional: true, nullable: true, optional: true, nullable: true,

View file

@ -72,6 +72,7 @@ export class TruncateAccountProcessorService {
const notes = await this.notesRepository.find({ const notes = await this.notesRepository.find({
where: { where: {
userId: user.id, userId: user.id,
isDeletable: true,
...(cursor ? { ...(cursor ? {
id: And(Not(In([...piningNoteIds, ...specifiedNoteIds])), MoreThan(cursor)), id: And(Not(In([...piningNoteIds, ...specifiedNoteIds])), MoreThan(cursor)),
} : { } : {