mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-23 09:06:23 +01:00
Fix the compose status states not inheriting properly
This commit is contained in:
parent
58208a417c
commit
79df9546bd
1 changed files with 25 additions and 25 deletions
|
@ -189,31 +189,6 @@ function Compose({
|
|||
setVisibility(visibility);
|
||||
setLanguage(language || prefs.postingDefaultLanguage || DEFAULT_LANG);
|
||||
setSensitive(sensitive);
|
||||
}
|
||||
if (draftStatus) {
|
||||
const {
|
||||
status,
|
||||
spoilerText,
|
||||
visibility,
|
||||
language,
|
||||
sensitive,
|
||||
poll,
|
||||
mediaAttachments,
|
||||
} = draftStatus;
|
||||
const composablePoll = !!poll?.options && {
|
||||
...poll,
|
||||
options: poll.options.map((o) => o?.title || o),
|
||||
expiresIn: poll?.expiresIn || expiresInFromExpiresAt(poll.expiresAt),
|
||||
};
|
||||
textareaRef.current.value = status;
|
||||
oninputTextarea();
|
||||
focusTextarea();
|
||||
spoilerTextRef.current.value = spoilerText;
|
||||
setVisibility(visibility);
|
||||
setLanguage(language || prefs.postingDefaultLanguage || DEFAULT_LANG);
|
||||
setSensitive(sensitive);
|
||||
setPoll(composablePoll);
|
||||
setMediaAttachments(mediaAttachments);
|
||||
} else if (editStatus) {
|
||||
const { visibility, language, sensitive, poll, mediaAttachments } =
|
||||
editStatus;
|
||||
|
@ -260,6 +235,31 @@ function Compose({
|
|||
setSensitive(prefs.postingDefaultSensitive);
|
||||
}
|
||||
}
|
||||
if (draftStatus) {
|
||||
const {
|
||||
status,
|
||||
spoilerText,
|
||||
visibility,
|
||||
language,
|
||||
sensitive,
|
||||
poll,
|
||||
mediaAttachments,
|
||||
} = draftStatus;
|
||||
const composablePoll = !!poll?.options && {
|
||||
...poll,
|
||||
options: poll.options.map((o) => o?.title || o),
|
||||
expiresIn: poll?.expiresIn || expiresInFromExpiresAt(poll.expiresAt),
|
||||
};
|
||||
textareaRef.current.value = status;
|
||||
oninputTextarea();
|
||||
focusTextarea();
|
||||
spoilerTextRef.current.value = spoilerText;
|
||||
setVisibility(visibility);
|
||||
setLanguage(language || prefs.postingDefaultLanguage || DEFAULT_LANG);
|
||||
setSensitive(sensitive);
|
||||
setPoll(composablePoll);
|
||||
setMediaAttachments(mediaAttachments);
|
||||
}
|
||||
}, [draftStatus, editStatus, replyToStatus]);
|
||||
|
||||
const formRef = useRef();
|
||||
|
|
Loading…
Reference in a new issue