fix: don't load text of empty draft
this fixes a small ux quirk where blanking a reply and cancelling it results in an empty reply next time you try to reply to that note, accidentally un-tagging everyone
This commit is contained in:
parent
5bc036180f
commit
2f5c51c1ca
1 changed files with 9 additions and 2 deletions
|
@ -923,12 +923,19 @@ onMounted(() => {
|
|||
if (!props.instant && !props.mention && !props.specified && !props.mock) {
|
||||
const draft = JSON.parse(miLocalStorage.getItem('drafts') ?? '{}')[draftKey.value];
|
||||
if (draft) {
|
||||
if (typeof draft.data.text === 'string' && draft.data.text.trim()) {
|
||||
text.value = draft.data.text;
|
||||
useCw.value = draft.data.useCw;
|
||||
}
|
||||
|
||||
if (typeof draft.data.cw === 'string' && draft.data.cw.trim()) {
|
||||
cw.value = draft.data.cw;
|
||||
}
|
||||
|
||||
useCw.value = draft.data.useCw;
|
||||
visibility.value = draft.data.visibility;
|
||||
localOnly.value = draft.data.localOnly;
|
||||
files.value = (draft.data.files || []).filter(draftFile => draftFile);
|
||||
|
||||
if (draft.data.poll) {
|
||||
poll.value = draft.data.poll;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue