Merge remote-tracking branch 'origin/oscar' into oscar
This commit is contained in:
commit
9927231add
5 changed files with 15 additions and 1 deletions
|
@ -343,6 +343,7 @@ export class NoteEntityService implements OnModuleInit {
|
|||
reactionEmojis: this.customEmojiService.populateEmojis(reactionEmojiNames, host),
|
||||
reactionAndUserPairCache: opts.withReactionAndUserPairCache ? note.reactionAndUserPairCache : undefined,
|
||||
emojis: host != null ? this.customEmojiService.populateEmojis(note.emojis, host) : undefined,
|
||||
isDeletable: note.isDeletable,
|
||||
tags: note.tags.length > 0 ? note.tags : undefined,
|
||||
fileIds: note.fileIds,
|
||||
files: packedFiles != null ? this.packAttachedFiles(note.fileIds, packedFiles, me) : this.driveFileEntityService.packManyByIds(note.fileIds, me),
|
||||
|
|
|
@ -193,6 +193,11 @@ export class MiNote {
|
|||
})
|
||||
public hasPoll: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
default: true,
|
||||
})
|
||||
public isDeletable: boolean;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
|
|
|
@ -255,7 +255,10 @@ export const packedNoteSchema = {
|
|||
type: 'number',
|
||||
optional: true, nullable: false,
|
||||
},
|
||||
|
||||
isDeletable: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
myReaction: {
|
||||
type: 'string',
|
||||
optional: true, nullable: true,
|
||||
|
|
|
@ -72,6 +72,7 @@ export class TruncateAccountProcessorService {
|
|||
const notes = await this.notesRepository.find({
|
||||
where: {
|
||||
userId: user.id,
|
||||
isDeletable: true,
|
||||
...(cursor ? {
|
||||
id: And(Not(In([...piningNoteIds, ...specifiedNoteIds])), MoreThan(cursor)),
|
||||
} : {
|
||||
|
|
|
@ -66,6 +66,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw err;
|
||||
});
|
||||
|
||||
if (note.id === 'a2h9mk6pav') {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
if (!await this.roleService.isModerator(me) && (note.userId !== me.id)) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue