diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx
index 3eb7fbac6a..8fdc62bc3b 100644
--- a/src/view/com/composer/Composer.tsx
+++ b/src/view/com/composer/Composer.tsx
@@ -293,13 +293,27 @@ export const ComposePost = ({
return false
}, [images, extGifAlt, extGif, requireAltTextEnabled])
+ const isEmptyPost =
+ richtext.text.trim().length === 0 &&
+ images.length === 0 &&
+ !extLink &&
+ !extGif &&
+ !quote &&
+ videoState.status === 'idle'
+
+ const canPost =
+ graphemeLength <= MAX_GRAPHEME_LENGTH &&
+ !isAltTextRequiredAndMissing &&
+ !isEmptyPost &&
+ videoState.status !== 'error'
+
const onPressPublish = React.useCallback(
async (finishedUploading: boolean) => {
- if (isPublishing || graphemeLength > MAX_GRAPHEME_LENGTH) {
+ if (isPublishing) {
return
}
- if (isAltTextRequiredAndMissing) {
+ if (!canPost) {
return
}
@@ -313,19 +327,6 @@ export const ComposePost = ({
}
setError('')
-
- if (
- richtext.text.trim().length === 0 &&
- images.length === 0 &&
- !extLink &&
- !extGif &&
- !quote &&
- videoState.status === 'idle'
- ) {
- setError(_(msg`Did you want to say anything?`))
- return
- }
-
setIsPublishing(true)
let postUri
@@ -410,10 +411,8 @@ export const ComposePost = ({
agent,
draft,
extLink,
- extGif,
images,
- graphemeLength,
- isAltTextRequiredAndMissing,
+ canPost,
isPublishing,
langPrefs.postLanguage,
onClose,
@@ -421,7 +420,6 @@ export const ComposePost = ({
quote,
initQuote,
replyTo,
- richtext.text,
setLangPrefs,
videoState.asset,
videoState.status,
@@ -438,11 +436,6 @@ export const ComposePost = ({
}
}, [onPressPublish, publishOnUpload, videoState.pendingPublish])
- const canPost = useMemo(
- () => graphemeLength <= MAX_GRAPHEME_LENGTH && !isAltTextRequiredAndMissing,
- [graphemeLength, isAltTextRequiredAndMissing],
- )
-
const onEmojiButtonPress = useCallback(() => {
openEmojiPicker?.(textInput.current?.getCursorPosition())
}, [openEmojiPicker])
@@ -692,7 +685,7 @@ function ComposerTopBar({
>
- ) : canPost ? (
+ ) : (
- ) : (
-
-
- Post
-
-
)}
{children}