From b2a4bb9dd0162b4629d1fc04ddd814effd3bb81b Mon Sep 17 00:00:00 2001 From: 6wFh3kVo Date: Wed, 7 Aug 2024 16:00:53 +0900 Subject: [PATCH] =?UTF-8?q?enhance(moderation):=20=E3=83=A2=E3=83=87?= =?UTF-8?q?=E3=83=AC=E3=83=BC=E3=82=BF=E3=83=BC=E3=81=8C=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=81=8C=E6=B7=BB=E4=BB=98=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=82=8B=E3=83=8E=E3=83=BC=E3=83=88=E3=82=92?= =?UTF-8?q?=E7=85=A7=E4=BC=9A=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com> Co-authored-by: nenohi Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com> --- .../server/api/endpoints/drive/files/attached-notes.ts | 4 +++- packages/frontend/src/pages/admin-file.vue | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts index 467039202524..b86059b5e7ac 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts @@ -10,6 +10,7 @@ import { QueryService } from '@/core/QueryService.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { DI } from '@/di-symbols.js'; import { ApiError } from '../../../error.js'; +import { RoleService } from '@/core/RoleService.js'; export const meta = { tags: ['drive', 'notes'], @@ -61,12 +62,13 @@ export default class extends Endpoint { // eslint- private noteEntityService: NoteEntityService, private queryService: QueryService, + private roleService: RoleService, ) { super(meta, paramDef, async (ps, me) => { // Fetch file const file = await this.driveFilesRepository.findOneBy({ id: ps.fileId, - userId: me.id, + userId: await this.roleService.isModerator(me) ? undefined : me.id, }); if (file == null) { diff --git a/packages/frontend/src/pages/admin-file.vue b/packages/frontend/src/pages/admin-file.vue index 22a3b11472b7..55cbd8fd9dd7 100644 --- a/packages/frontend/src/pages/admin-file.vue +++ b/packages/frontend/src/pages/admin-file.vue @@ -44,6 +44,9 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts.delete }} +
+ +
{{ i18n.ts.requireAdminForView }} @@ -67,7 +70,7 @@ SPDX-License-Identifier: AGPL-3.0-only