playの公開範囲を設定できるように

This commit is contained in:
GrapeApple0 2023-08-07 09:40:52 +00:00
parent bc3f69df60
commit b9e1300e19
8 changed files with 40 additions and 5 deletions

View File

@ -680,6 +680,7 @@ createNewClip: "Create new clip"
unclip: "Unclip"
confirmToUnclipAlreadyClippedNote: "This note is already part of the \"{name}\" clip. Do you want to remove it from this clip instead?"
public: "Public"
private: "Private"
i18nInfo: "Misskey is being translated into various languages by volunteers. You can help at {link}."
manageAccessTokens: "Manage access tokens"
accountInfo: "Account Info"

1
locales/index.d.ts vendored
View File

@ -683,6 +683,7 @@ export interface Locale {
"unclip": string;
"confirmToUnclipAlreadyClippedNote": string;
"public": string;
"private": string;
"i18nInfo": string;
"manageAccessTokens": string;
"accountInfo": string;

View File

@ -680,6 +680,7 @@ createNewClip: "新しいクリップを作成"
unclip: "クリップ解除"
confirmToUnclipAlreadyClippedNote: "このノートはすでにクリップ「{name}」に含まれています。ノートをこのクリップから除外しますか?"
public: "パブリック"
private: "非公開"
i18nInfo: "Misskeyは有志によって様々な言語に翻訳されています。{link}で翻訳に協力できます。"
manageAccessTokens: "アクセストークンの管理"
accountInfo: "アカウント情報"

View File

@ -0,0 +1,15 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class PlayVisibility1689102832143 {
name = 'PlayVisibility1690796169261'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "public"."flash" ADD "visibility" "page_visibility_enum" NOT NULL DEFAULT 'public'`, undefined);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "public"."flash" DROP COLUMN "visibility"`, undefined);
}
}

View File

@ -61,4 +61,11 @@ export class Flash {
default: 0,
})
public likedCount: number;
/**
* public ...
* private ...
*/
@Column('enum', { enum: ['public', 'private'] })
public visibility: 'public' | 'private';
}

View File

@ -48,7 +48,9 @@ export const paramDef = {
script: { type: 'string' },
permissions: { type: 'array', items: {
type: 'string',
} },
},
},
visibility: { type: 'string', enum: ['public', 'private'] },
},
required: ['flashId', 'title', 'summary', 'script', 'permissions'],
} as const;

View File

@ -44,13 +44,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
) {
super(meta, paramDef, async (ps, me) => {
const query = this.queryService.makePaginationQuery(this.flashsRepository.createQueryBuilder('flash'), ps.sinceId, ps.untilId)
.andWhere('flash.userId = :userId', { userId: ps.userId });
.andWhere('flash.userId = :userId', { userId: ps.userId })
.andWhere('flash.visibility = \'public\'');
const pages = await query
const flashs = await query
.limit(ps.limit)
.getMany();
return await this.flashEntityService.packMany(pages);
return await this.flashEntityService.packMany(flashs);
});
}
}

View File

@ -23,6 +23,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<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.uiLanguage }}</template>
<option :key="'public'" :value="'public'">{{ i18n.ts.public }}</option>
<option :key="'private'" :value="'private'">{{ i18n.ts.private }}</option>
</MkSelect>
</div>
</MkSpacer>
</MkStickyContainer>
@ -36,6 +41,7 @@ import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
import MkTextarea from '@/components/MkTextarea.vue';
import MkInput from '@/components/MkInput.vue';
import MkSelect from '@/components/MkSelect.vue';
import { useRouter } from '@/router';
const PRESET_DEFAULT = `/// @ 0.15.0
@ -358,7 +364,7 @@ const props = defineProps<{
}>();
let flash = $ref(null);
let visibility = $ref("public");
if (props.id) {
flash = await os.api('flash/show', {
flashId: props.id,
@ -402,6 +408,7 @@ async function save() {
summary,
permissions,
script,
visibility,
});
} else {
const created = await os.apiWithDialog('flash/create', {