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