chore: use sync MkVisibiliityPicker
This commit is contained in:
parent
0b231e6d24
commit
e486715e9a
5 changed files with 20 additions and 23 deletions
|
@ -297,15 +297,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
computed,
|
||||
defineAsyncComponent,
|
||||
inject,
|
||||
nextTick,
|
||||
onMounted,
|
||||
ref,
|
||||
watch,
|
||||
} from "vue";
|
||||
import { computed, inject, nextTick, onMounted, ref, watch } from "vue";
|
||||
import * as mfm from "mfm-js";
|
||||
import autosize from "autosize";
|
||||
import insertTextAtCursor from "insert-text-at-cursor";
|
||||
|
@ -347,6 +339,7 @@ import {
|
|||
} from "@/scripts/language-utils";
|
||||
import type { MenuItem } from "@/types/menu";
|
||||
import icon from "@/scripts/icon";
|
||||
import MkVisibilityPicker from "@/components/MkVisibilityPicker.vue";
|
||||
|
||||
const modal = inject("modal");
|
||||
|
||||
|
@ -358,7 +351,7 @@ const props = withDefaults(
|
|||
mention?: entities.User;
|
||||
specified?: entities.User;
|
||||
initialText?: string;
|
||||
initialVisibility?: typeof noteVisibilities;
|
||||
initialVisibility?: (typeof noteVisibilities)[number];
|
||||
initialLanguage?: typeof languages;
|
||||
initialFiles?: entities.DriveFile[];
|
||||
initialLocalOnly?: boolean;
|
||||
|
@ -412,10 +405,9 @@ const localOnly = ref<boolean>(
|
|||
);
|
||||
const visibility = ref(
|
||||
props.initialVisibility ??
|
||||
((defaultStore.state.rememberNoteVisibility
|
||||
(defaultStore.state.rememberNoteVisibility
|
||||
? defaultStore.state.visibility
|
||||
: defaultStore.state
|
||||
.defaultNoteVisibility) as (typeof noteVisibilities)[number]),
|
||||
: defaultStore.state.defaultNoteVisibility),
|
||||
);
|
||||
|
||||
const visibleUsers = ref([]);
|
||||
|
@ -737,7 +729,7 @@ function setVisibility() {
|
|||
}
|
||||
|
||||
os.popup(
|
||||
defineAsyncComponent(() => import("@/components/MkVisibilityPicker.vue")),
|
||||
MkVisibilityPicker,
|
||||
{
|
||||
currentVisibility: visibility.value,
|
||||
currentLocalOnly: localOnly.value,
|
||||
|
|
|
@ -32,7 +32,7 @@ const props = defineProps<{
|
|||
mention?: entities.User;
|
||||
specified?: entities.User;
|
||||
initialText?: string;
|
||||
initialVisibility?: typeof noteVisibilities;
|
||||
initialVisibility?: (typeof noteVisibilities)[number];
|
||||
initialLanguage?: typeof languages;
|
||||
initialFiles?: entities.DriveFile[];
|
||||
initialLocalOnly?: boolean;
|
||||
|
|
|
@ -54,8 +54,16 @@ const url = urlParams.get("url");
|
|||
const initialText = ref(null as string | null);
|
||||
const reply = ref(null as entities.Note | null);
|
||||
const renote = ref(null as entities.Note | null);
|
||||
|
||||
function isVisibility(
|
||||
v: string | null,
|
||||
): v is (typeof noteVisibilities)[number] {
|
||||
if (v == null) return false;
|
||||
return (noteVisibilities as readonly string[]).includes(v);
|
||||
}
|
||||
|
||||
const visibility = ref(
|
||||
noteVisibilities.includes(visibilityQuery) ? visibilityQuery : null,
|
||||
isVisibility(visibilityQuery) ? visibilityQuery : undefined,
|
||||
);
|
||||
const localOnly = ref(
|
||||
localOnlyQuery === "0" ? false : localOnlyQuery === "1" ? true : null,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { markRaw, ref } from "vue";
|
||||
import { isSignedIn } from "./me";
|
||||
import { Storage } from "./pizzax";
|
||||
import type { noteVisibilities } from "firefish-js";
|
||||
|
||||
export const postFormActions = [];
|
||||
export const userActions = [];
|
||||
|
@ -75,7 +76,7 @@ export const defaultStore = markRaw(
|
|||
},
|
||||
defaultNoteVisibility: {
|
||||
where: "account",
|
||||
default: "public",
|
||||
default: "public" as (typeof noteVisibilities)[number],
|
||||
},
|
||||
defaultNoteLocalOnly: {
|
||||
where: "account",
|
||||
|
@ -123,12 +124,7 @@ export const defaultStore = markRaw(
|
|||
},
|
||||
visibility: {
|
||||
where: "deviceAccount",
|
||||
default: "public" as
|
||||
| "public"
|
||||
| "home"
|
||||
| "followers"
|
||||
| "specified"
|
||||
| "private",
|
||||
default: "public" as (typeof noteVisibilities)[number],
|
||||
},
|
||||
localOnly: {
|
||||
where: "deviceAccount",
|
||||
|
|
|
@ -18,6 +18,7 @@ export const noteVisibilities = [
|
|||
"home",
|
||||
"followers",
|
||||
"specified",
|
||||
"private",
|
||||
] as const;
|
||||
|
||||
export const mutedNoteReasons = ["word", "manual", "spam", "other"] as const;
|
||||
|
|
Loading…
Reference in a new issue