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

visibility defaults to private #52

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions packages/backend/src/core/entities/FlashEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class FlashEntityService {
summary: flash.summary,
script: flash.script,
likedCount: flash.likedCount,
visibility: flash.visibility,
isLiked: meId ? await this.flashLikesRepository.exists({ where: { flashId: flash.id, userId: meId } }) : undefined,
});
}
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: 'private' },
},
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
15 changes: 15 additions & 0 deletions packages/frontend/src/components/MkFlashPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,32 @@
<p>{{ userName(flash.user) }}</p>
</footer>
</article>
<XButton v-if="showVisibility" class="summaryVisiSwitch" :checked="flash.visibility" @toggle="onToggleVisi"></XButton>
</MkA>
</template>

<script lang="ts" setup>
import { } from 'vue';
import { userName } from '@/filters/user.js';
import * as os from '@/os.js';
import XButton from './MkSwitch.button.vue';

const props = defineProps<{
//flash: Misskey.entities.Flash;
flash: any;
showVisibility: boolean;
}>();

function onToggleVisi() {
os.apiWithDialog('flash/update', {
flashId: flash.id,

Check failure on line 38 in packages/frontend/src/components/MkFlashPreview.vue

View workflow job for this annotation

GitHub Actions / lint (frontend)

'flash' is not defined
title: flash.title,

Check failure on line 39 in packages/frontend/src/components/MkFlashPreview.vue

View workflow job for this annotation

GitHub Actions / lint (frontend)

'flash' is not defined
summary: flash.summary,

Check failure on line 40 in packages/frontend/src/components/MkFlashPreview.vue

View workflow job for this annotation

GitHub Actions / lint (frontend)

'flash' is not defined
permissions: flash.permissions,

Check failure on line 41 in packages/frontend/src/components/MkFlashPreview.vue

View workflow job for this annotation

GitHub Actions / lint (frontend)

'flash' is not defined
script: flash.script,

Check failure on line 42 in packages/frontend/src/components/MkFlashPreview.vue

View workflow job for this annotation

GitHub Actions / lint (frontend)

'flash' is not defined
visibility: flash.visibility === 'private' ? 'public' : 'private',

Check failure on line 43 in packages/frontend/src/components/MkFlashPreview.vue

View workflow job for this annotation

GitHub Actions / lint (frontend)

'flash' is not defined
});
}
</script>

<style lang="scss" scoped>
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/flash/flash-edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ const props = defineProps<{
}>();

const flash = ref<Misskey.entities.Flash | null>(null);
const visibility = ref<Misskey.entities.FlashUpdateRequest['visibility']>('public');

if (props.id) {
flash.value = await misskeyApi('flash/show', {
Expand All @@ -379,6 +378,7 @@ const title = ref(flash.value?.title ?? 'New Play');
const summary = ref(flash.value?.summary ?? '');
const permissions = ref(flash.value?.permissions ?? []);
const script = ref(flash.value?.script ?? PRESET_DEFAULT);
const visibility = ref(flash.value?.visibility ?? 'private');

function selectPreset(ev: MouseEvent) {
os.popupMenu([{
Expand Down
Loading