mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-24 18:26:17 +03:00
fix: default reply to visibility (urgent) (#194)
This commit is contained in:
parent
0843878a42
commit
8076e5f069
3 changed files with 8 additions and 6 deletions
|
@ -8,16 +8,18 @@ const {
|
|||
draftKey,
|
||||
placeholder = 'What is on your mind?',
|
||||
inReplyToId,
|
||||
inReplyToVisibility = 'public',
|
||||
expanded: _expanded = false,
|
||||
} = defineProps<{
|
||||
draftKey: string
|
||||
placeholder?: string
|
||||
inReplyToId?: string
|
||||
inReplyToVisibility?: StatusVisibility
|
||||
expanded?: boolean
|
||||
}>()
|
||||
|
||||
let isSending = $ref(false)
|
||||
let { draft } = $(useDraft(draftKey, inReplyToId))
|
||||
let { draft } = $(useDraft(draftKey, inReplyToId, inReplyToVisibility))
|
||||
const isExistDraft = $computed(() => !!draft.params.status && draft.params.status !== '<p></p>')
|
||||
let isExpanded = $ref(isExistDraft || _expanded)
|
||||
|
||||
|
@ -119,7 +121,7 @@ async function publish() {
|
|||
else
|
||||
await useMasto().statuses.update(draft.editingStatus.id, payload)
|
||||
|
||||
draft = getDefaultDraft({ inReplyToId })
|
||||
draft = getDefaultDraft({ inReplyToId, visibility: inReplyToVisibility })
|
||||
isPublishDialogOpen.value = false
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Account, Attachment, CreateStatusParams, Status } from 'masto'
|
||||
import type { Account, Attachment, CreateStatusParams, Status, StatusVisibility } from 'masto'
|
||||
import { STORAGE_KEY_DRAFTS } from '~/constants'
|
||||
import type { Mutable } from '~/types/utils'
|
||||
|
||||
|
@ -45,12 +45,11 @@ export function getParamsFromStatus(status: Status): Draft['params'] {
|
|||
}
|
||||
}
|
||||
|
||||
export function useDraft(draftKey: string, inReplyToId?: string) {
|
||||
export function useDraft(draftKey: string, inReplyToId?: string, inReplyToVisibility?: StatusVisibility) {
|
||||
const draft = computed({
|
||||
get() {
|
||||
if (!currentUserDrafts.value[draftKey])
|
||||
currentUserDrafts.value[draftKey] = getDefaultDraft({ inReplyToId })
|
||||
|
||||
currentUserDrafts.value[draftKey] = getDefaultDraft({ inReplyToId, visibility: inReplyToVisibility })
|
||||
return currentUserDrafts.value[draftKey]
|
||||
},
|
||||
set(val) {
|
||||
|
|
|
@ -57,6 +57,7 @@ onReactivated(() => {
|
|||
:draft-key="`reply-${id}`"
|
||||
:placeholder="`Reply to ${status?.account ? getDisplayName(status.account) : 'this thread'}`"
|
||||
:in-reply-to-id="id"
|
||||
:in-reply-to-visibility="status.visibility"
|
||||
/>
|
||||
|
||||
<template v-if="context">
|
||||
|
|
Loading…
Reference in a new issue