don't filter /drive/files/attached-notes when called by a moderator
This commit is contained in:
parent
f5df44e028
commit
a756b309f0
1 changed files with 12 additions and 6 deletions
|
|
@ -71,10 +71,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
private roleService: RoleService,
|
private roleService: RoleService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
|
const isModerator = await this.roleService.isModerator(me);
|
||||||
|
|
||||||
// Fetch file
|
// Fetch file
|
||||||
const file = await this.driveFilesRepository.findOneBy({
|
const file = await this.driveFilesRepository.findOneBy({
|
||||||
id: ps.fileId,
|
id: ps.fileId,
|
||||||
userId: await this.roleService.isModerator(me) ? undefined : me.id,
|
userId: isModerator ? undefined : me.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
|
|
@ -90,16 +92,20 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
.leftJoinAndSelect('renote.user', 'renoteUser')
|
.leftJoinAndSelect('renote.user', 'renoteUser')
|
||||||
.limit(ps.limit);
|
.limit(ps.limit);
|
||||||
|
|
||||||
|
if (!isModerator) {
|
||||||
this.queryService.generateVisibilityQuery(query, me);
|
this.queryService.generateVisibilityQuery(query, me);
|
||||||
this.queryService.generateBlockedHostQueryForNote(query);
|
this.queryService.generateBlockedHostQueryForNote(query);
|
||||||
this.queryService.generateSilencedUserQueryForNotes(query, me);
|
this.queryService.generateSilencedUserQueryForNotes(query, me);
|
||||||
this.queryService.generateMutedUserQueryForNotes(query, me);
|
this.queryService.generateMutedUserQueryForNotes(query, me);
|
||||||
|
this.queryService.generateMutedNoteThreadQuery(query, me);
|
||||||
this.queryService.generateBlockedUserQueryForNotes(query, me);
|
this.queryService.generateBlockedUserQueryForNotes(query, me);
|
||||||
|
}
|
||||||
|
|
||||||
const notes = await query.getMany();
|
const notes = await query.getMany();
|
||||||
|
|
||||||
return await this.noteEntityService.packMany(notes, me, {
|
return await this.noteEntityService.packMany(notes, me, {
|
||||||
detail: true,
|
detail: true,
|
||||||
|
skipHide: isModerator,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue