Fix image send without description
This commit is contained in:
parent
57f7dc1b16
commit
6afb6f9ac3
1 changed files with 14 additions and 3 deletions
|
@ -13,6 +13,7 @@ import type { LocalizerType, ThemeType } from '../types/Util';
|
|||
import type { ErrorDialogAudioRecorderType } from '../types/AudioRecorder';
|
||||
import { RecordingState } from '../types/AudioRecorder';
|
||||
import type { imageToBlurHash } from '../util/imageToBlurHash';
|
||||
import { dropNull } from '../util/dropNull';
|
||||
import { Spinner } from './Spinner';
|
||||
import type {
|
||||
Props as EmojiButtonProps,
|
||||
|
@ -358,13 +359,23 @@ export const CompositionArea = memo(function CompositionArea({
|
|||
const draftEditMessageBody = draftEditMessage?.body;
|
||||
const editedMessageId = draftEditMessage?.targetMessageId;
|
||||
|
||||
const canSend =
|
||||
// Text or link preview edited
|
||||
dirty ||
|
||||
// Quote of edited message changed
|
||||
(draftEditMessage != null &&
|
||||
dropNull(draftEditMessage.quote?.messageId) !==
|
||||
dropNull(quotedMessageId)) ||
|
||||
// Not edit message, but has attachments
|
||||
(draftEditMessage == null && draftAttachments.length !== 0);
|
||||
|
||||
const handleSubmit = useCallback(
|
||||
(
|
||||
message: string,
|
||||
bodyRanges: DraftBodyRanges,
|
||||
timestamp: number
|
||||
): boolean => {
|
||||
if (!dirty) {
|
||||
if (!canSend) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -393,7 +404,7 @@ export const CompositionArea = memo(function CompositionArea({
|
|||
},
|
||||
[
|
||||
conversationId,
|
||||
dirty,
|
||||
canSend,
|
||||
draftAttachments,
|
||||
editedMessageId,
|
||||
quotedMessageSentAt,
|
||||
|
@ -603,7 +614,7 @@ export const CompositionArea = memo(function CompositionArea({
|
|||
<button
|
||||
aria-label={i18n('icu:CompositionArea__edit-action--send')}
|
||||
className="CompositionArea__edit-button CompositionArea__edit-button--accept"
|
||||
disabled={!dirty}
|
||||
disabled={!canSend}
|
||||
onClick={() => inputApiRef.current?.submit()}
|
||||
type="button"
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue