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

Misskey Playのノート投稿画面で「内容を隠す」を設定できるようにする #12576

Merged
merged 3 commits into from
Dec 9, 2023
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: 2 additions & 0 deletions packages/frontend/src/components/MkAsUi.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ SPDX-License-Identifier: AGPL-3.0-only
fixed
:instant="true"
:initialText="c.form.text"
:initialCw="c.form.cw"
/>
</div>
<MkFolder v-else-if="c.type === 'folder'" :defaultOpen="c.opened">
Expand Down Expand Up @@ -97,6 +98,7 @@ function onSwitchUpdate(v) {
function openPostForm() {
os.post({
initialText: c.form.text,
initialCw: c.form.cw,
instant: true,
});
}
Expand Down
5 changes: 3 additions & 2 deletions packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ const props = withDefaults(defineProps<{
mention?: Misskey.entities.User;
specified?: Misskey.entities.User;
initialText?: string;
initialCw?: string;
initialVisibility?: (typeof Misskey.noteVisibilities)[number];
initialFiles?: Misskey.entities.DriveFile[];
initialLocalOnly?: boolean;
Expand Down Expand Up @@ -177,10 +178,10 @@ const poll = ref<{
expiresAt: string | null;
expiredAfter: string | null;
} | null>(null);
const useCw = ref(false);
const useCw = ref<boolean>(!!props.initialCw);
const showPreview = ref(defaultStore.state.showPreview);
watch(showPreview, () => defaultStore.set('showPreview', showPreview.value));
const cw = ref<string | null>(null);
const cw = ref<string | null>(props.initialCw ?? null);
const localOnly = ref<boolean>(props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly);
const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility) as typeof Misskey.noteVisibilities[number]);
const visibleUsers = ref([]);
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/src/components/MkPostFormDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const props = defineProps<{
mention?: Misskey.entities.User;
specified?: Misskey.entities.User;
initialText?: string;
initialCw?: string;
initialVisibility?: typeof Misskey.noteVisibilities;
initialFiles?: Misskey.entities.DriveFile[];
initialLocalOnly?: boolean;
Expand Down
8 changes: 8 additions & 0 deletions packages/frontend/src/scripts/aiscript/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ export type AsUiPostFormButton = AsUiComponentBase & {
rounded?: boolean;
form?: {
text: string;
cw?: string;
};
};

export type AsUiPostForm = AsUiComponentBase & {
type: 'postForm';
form?: {
text: string;
cw?: string;
};
};

Expand Down Expand Up @@ -454,8 +456,11 @@ function getPostFormButtonOptions(def: values.Value | undefined, call: (fn: valu
const getForm = () => {
const text = form!.value.get('text');
utils.assertString(text);
const cw = form!.value.get('cw');
if (cw) utils.assertString(cw);
return {
text: text.value,
cw: cw?.value,
};
};

Expand All @@ -478,8 +483,11 @@ function getPostFormOptions(def: values.Value | undefined, call: (fn: values.VFn
const getForm = () => {
const text = form!.value.get('text');
utils.assertString(text);
const cw = form!.value.get('cw');
if (cw) utils.assertString(cw);
return {
text: text.value,
cw: cw?.value,
};
};

Expand Down
Loading