feat: adminのファイル一覧画面で、ファイルが添付されているノートを一覧できるように (#14403)

* enhance(moderation): モデレーターがファイルが添付されているノートを照会できるように (MisskeyIO#680)

Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com>
Co-authored-by: nenohi <kimutipartylove@gmail.com>
Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
(cherry picked from commit b059162324d2cfc697d1af9f3b6fb49fad2734e0)

* Update Changelog

* ✌️

Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com>
Co-authored-by: nenohi <kimutipartylove@gmail.com>
Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>

---------

Co-authored-by: Yuuki <yukikum57@gmail.com>
Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com>
Co-authored-by: nenohi <kimutipartylove@gmail.com>
Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
This commit is contained in:
かっこかり 2024-09-24 10:11:09 +09:00 committed by GitHub
parent 98de7ca526
commit 3674e9b1cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 2 deletions

View File

@ -2,6 +2,8 @@
### General ### General
- Feat: UserWebhookとSystemWebhookのテスト送信機能を追加 (#14445) - Feat: UserWebhookとSystemWebhookのテスト送信機能を追加 (#14445)
- Feat: モデレーターはユーザーにかかわらずファイルが添付されているノートを検索できるように
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/680)
- Enhance: ユーザーによるコンテンツインポートの可否をロールポリシーで制御できるように - Enhance: ユーザーによるコンテンツインポートの可否をロールポリシーで制御できるように
### Client ### Client

View File

@ -10,6 +10,7 @@ import { QueryService } from '@/core/QueryService.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import { ApiError } from '../../../error.js'; import { ApiError } from '../../../error.js';
import { RoleService } from '@/core/RoleService.js';
export const meta = { export const meta = {
tags: ['drive', 'notes'], tags: ['drive', 'notes'],
@ -61,12 +62,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private noteEntityService: NoteEntityService, private noteEntityService: NoteEntityService,
private queryService: QueryService, private queryService: QueryService,
private roleService: RoleService,
) { ) {
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
// Fetch file // Fetch file
const file = await this.driveFilesRepository.findOneBy({ const file = await this.driveFilesRepository.findOneBy({
id: ps.fileId, id: ps.fileId,
userId: me.id, userId: await this.roleService.isModerator(me) ? undefined : me.id,
}); });
if (file == null) { if (file == null) {

View File

@ -44,6 +44,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkButton danger @click="del"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton> <MkButton danger @click="del"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div> </div>
</div> </div>
<div v-else-if="tab === 'notes' && info" class="_gaps_m">
<XNotes :fileId="fileId"/>
</div>
<div v-else-if="tab === 'ip' && info" class="_gaps_m"> <div v-else-if="tab === 'ip' && info" class="_gaps_m">
<MkInfo v-if="!iAmAdmin" warn>{{ i18n.ts.requireAdminForView }}</MkInfo> <MkInfo v-if="!iAmAdmin" warn>{{ i18n.ts.requireAdminForView }}</MkInfo>
<MkKeyValue v-if="info.requestIp" class="_monospace" :copy="info.requestIp" oneline> <MkKeyValue v-if="info.requestIp" class="_monospace" :copy="info.requestIp" oneline>
@ -67,7 +70,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref } from 'vue'; import { computed, defineAsyncComponent, ref } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkSwitch from '@/components/MkSwitch.vue'; import MkSwitch from '@/components/MkSwitch.vue';
@ -88,6 +91,7 @@ const tab = ref('overview');
const file = ref<Misskey.entities.DriveFile | null>(null); const file = ref<Misskey.entities.DriveFile | null>(null);
const info = ref<Misskey.entities.AdminDriveShowFileResponse | null>(null); const info = ref<Misskey.entities.AdminDriveShowFileResponse | null>(null);
const isSensitive = ref<boolean>(false); const isSensitive = ref<boolean>(false);
const XNotes = defineAsyncComponent(() => import('./drive.file.notes.vue'));
const props = defineProps<{ const props = defineProps<{
fileId: string, fileId: string,
@ -131,6 +135,10 @@ const headerTabs = computed(() => [{
title: i18n.ts.overview, title: i18n.ts.overview,
icon: 'ti ti-info-circle', icon: 'ti ti-info-circle',
}, iAmModerator ? { }, iAmModerator ? {
key: 'notes',
title: i18n.ts._fileViewer.attachedNotes,
icon: 'ti ti-pencil',
} : null, iAmModerator ? {
key: 'ip', key: 'ip',
title: 'IP', title: 'IP',
icon: 'ti ti-password', icon: 'ti ti-password',