fix(general): flash/createでPlayの公開範囲を指定できない問題の修正と編集画面の調整 (#13574)

* fix(backend): param `visibility` wasn't included in `flash/create`

* fix(frontend): tweak flash editor ui

* Update CHANGELOG.md
This commit is contained in:
zyoshoka 2024-03-15 22:02:57 +09:00 committed by GitHub
parent 71d0538647
commit 4b1ca9ef61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 21 additions and 7 deletions

View file

@ -1,7 +1,7 @@
## Unreleased ## Unreleased
### General ### General
- - Fix: Play作成時に設定した公開範囲が機能していない問題を修正
### Client ### Client
- Enhance: 自分のノートの添付ファイルから直接ファイルの詳細ページに飛べるように - Enhance: 自分のノートの添付ファイルから直接ファイルの詳細ページに飛べるように

4
locales/index.d.ts vendored
View file

@ -8635,6 +8635,10 @@ export interface Locale extends ILocale {
* *
*/ */
"summary": string; "summary": string;
/**
* URLを知っている人は引き続きアクセスできます
*/
"visibilityDescription": string;
}; };
"_pages": { "_pages": {
/** /**

View file

@ -2280,6 +2280,7 @@ _play:
title: "タイトル" title: "タイトル"
script: "スクリプト" script: "スクリプト"
summary: "説明" summary: "説明"
visibilityDescription: "非公開に設定するとプロフィールに表示されなくなりますが、URLを知っている人は引き続きアクセスできます。"
_pages: _pages:
newPage: "ページの作成" newPage: "ページの作成"

View file

@ -44,6 +44,7 @@ export const paramDef = {
permissions: { type: 'array', items: { permissions: { type: 'array', items: {
type: 'string', type: 'string',
} }, } },
visibility: { type: 'string', enum: ['public', 'private'], default: 'public' },
}, },
required: ['title', 'summary', 'script', 'permissions'], required: ['title', 'summary', 'script', 'permissions'],
} as const; } as const;
@ -66,6 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
summary: ps.summary, summary: ps.summary,
script: ps.script, script: ps.script,
permissions: ps.permissions, permissions: ps.permissions,
visibility: ps.visibility,
}).then(x => this.flashsRepository.findOneByOrFail(x.identifiers[0])); }).then(x => this.flashsRepository.findOneByOrFail(x.identifiers[0]));
return await this.flashEntityService.pack(flash); return await this.flashEntityService.pack(flash);

View file

@ -18,16 +18,17 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkCodeEditor v-model="script" lang="is"> <MkCodeEditor v-model="script" lang="is">
<template #label>{{ i18n.ts._play.script }}</template> <template #label>{{ i18n.ts._play.script }}</template>
</MkCodeEditor> </MkCodeEditor>
<MkSelect v-model="visibility">
<template #label>{{ i18n.ts.visibility }}</template>
<template #caption>{{ i18n.ts._play.visibilityDescription }}</template>
<option :key="'public'" :value="'public'">{{ i18n.ts.public }}</option>
<option :key="'private'" :value="'private'">{{ i18n.ts.private }}</option>
</MkSelect>
<div class="_buttons"> <div class="_buttons">
<MkButton primary @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton> <MkButton primary @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
<MkButton @click="show"><i class="ti ti-eye"></i> {{ i18n.ts.show }}</MkButton> <MkButton @click="show"><i class="ti ti-eye"></i> {{ i18n.ts.show }}</MkButton>
<MkButton v-if="flash" danger @click="del"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton> <MkButton v-if="flash" danger @click="del"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div> </div>
<MkSelect v-model="visibility">
<template #label>{{ i18n.ts.visibility }}</template>
<option :key="'public'" :value="'public'">{{ i18n.ts.public }}</option>
<option :key="'private'" :value="'private'">{{ i18n.ts.private }}</option>
</MkSelect>
</div> </div>
</MkSpacer> </MkSpacer>
</MkStickyContainer> </MkStickyContainer>
@ -367,7 +368,7 @@ const props = defineProps<{
}>(); }>();
const flash = ref<Misskey.entities.Flash | null>(null); const flash = ref<Misskey.entities.Flash | null>(null);
const visibility = ref<Misskey.entities.FlashUpdateRequest['visibility']>('public'); const visibility = ref<'private' | 'public'>('public');
if (props.id) { if (props.id) {
flash.value = await misskeyApi('flash/show', { flash.value = await misskeyApi('flash/show', {
@ -420,6 +421,7 @@ async function save() {
summary: summary.value, summary: summary.value,
permissions: permissions.value, permissions: permissions.value,
script: script.value, script: script.value,
visibility: visibility.value,
}); });
router.push('/play/' + created.id + '/edit'); router.push('/play/' + created.id + '/edit');
} }

View file

@ -22686,6 +22686,11 @@ export type operations = {
summary: string; summary: string;
script: string; script: string;
permissions: string[]; permissions: string[];
/**
* @default public
* @enum {string}
*/
visibility?: 'public' | 'private';
}; };
}; };
}; };