Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Unreleased

### General
-
- Fix: Play作成時に設定した公開範囲が機能していない問題を修正

### Client
- Enhance: 自分のノートの添付ファイルから直接ファイルの詳細ページに飛べるように
Expand Down
4 changes: 4 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8631,6 +8631,10 @@ export interface Locale extends ILocale {
* 説明
*/
"summary": string;
/**
* 非公開に設定するとプロフィールに表示されなくなりますが、URLを知っている人は引き続きアクセスできます。
*/
"visibilityDescription": string;
};
"_pages": {
/**
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,7 @@ _play:
title: "タイトル"
script: "スクリプト"
summary: "説明"
visibilityDescription: "非公開に設定するとプロフィールに表示されなくなりますが、URLを知っている人は引き続きアクセスできます。"

_pages:
newPage: "ページの作成"
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints/flash/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const paramDef = {
permissions: { type: 'array', items: {
type: 'string',
} },
visibility: { type: 'string', enum: ['public', 'private'], default: 'public' },
},
required: ['title', 'summary', 'script', 'permissions'],
} as const;
Expand All @@ -66,6 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
summary: ps.summary,
script: ps.script,
permissions: ps.permissions,
visibility: ps.visibility,
}).then(x => this.flashsRepository.findOneByOrFail(x.identifiers[0]));

return await this.flashEntityService.pack(flash);
Expand Down
14 changes: 8 additions & 6 deletions packages/frontend/src/pages/flash/flash-edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkCodeEditor v-model="script" lang="is">
<template #label>{{ i18n.ts._play.script }}</template>
</MkCodeEditor>
<div class="_buttons">
<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 v-if="flash" danger @click="del"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div>
<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">
<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 v-if="flash" danger @click="del"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div>
</div>
</MkSpacer>
</MkStickyContainer>
Expand Down Expand Up @@ -367,7 +368,7 @@ const props = defineProps<{
}>();

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) {
flash.value = await misskeyApi('flash/show', {
Expand Down Expand Up @@ -420,6 +421,7 @@ async function save() {
summary: summary.value,
permissions: permissions.value,
script: script.value,
visibility: visibility.value,
});
router.push('/play/' + created.id + '/edit');
}
Expand Down
5 changes: 5 additions & 0 deletions packages/misskey-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22686,6 +22686,11 @@ export type operations = {
summary: string;
script: string;
permissions: string[];
/**
* @default public
* @enum {string}
*/
visibility?: 'public' | 'private';
};
};
};
Expand Down
Loading