Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Chat - User is able to send message with max character limit #50487

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/AttachmentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ type AttachmentModalProps = {
fallbackSource?: AvatarSource;

canEditReceipt?: boolean;

shouldDisableSendButton?: boolean;
};

function AttachmentModal({
Expand All @@ -158,6 +160,7 @@ function AttachmentModal({
shouldShowNotFoundPage = false,
type = undefined,
accountID = undefined,
shouldDisableSendButton = false,
}: AttachmentModalProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand Down Expand Up @@ -589,7 +592,7 @@ function AttachmentModal({
textStyles={[styles.buttonConfirmText]}
text={translate('common.send')}
onPress={submitAndClose}
isDisabled={isConfirmButtonDisabled}
isDisabled={isConfirmButtonDisabled || shouldDisableSendButton}
pressOnEnter
/>
</Animated.View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ type AttachmentPickerWithMenuItemsProps = {

/** The personal details of everyone in the report */
reportParticipantIDs?: number[];

shouldDisableAttachmentItem?: boolean;
};

/**
Expand All @@ -110,6 +112,7 @@ function AttachmentPickerWithMenuItems({
onItemSelected,
actionButtonRef,
raiseIsScrollLikelyLayoutTriggered,
shouldDisableAttachmentItem,
}: AttachmentPickerWithMenuItemsProps) {
const isFocused = useIsFocused();
const theme = useTheme();
Expand Down Expand Up @@ -236,6 +239,7 @@ function AttachmentPickerWithMenuItems({
triggerAttachmentPicker();
},
shouldCallAfterModalHide: true,
disabled: shouldDisableAttachmentItem,
},
];
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ function ReportActionCompose({
onConfirm={addAttachment}
onModalShow={() => setIsAttachmentPreviewActive(true)}
onModalHide={onAttachmentPreviewClose}
shouldDisableSendButton={hasExceededMaxCommentLength}
>
{({displayFileInModal}) => (
<>
Expand All @@ -451,6 +452,7 @@ function ReportActionCompose({
onAddActionPressed={onAddActionPressed}
onItemSelected={onItemSelected}
actionButtonRef={actionButtonRef}
shouldDisableAttachmentItem={hasExceededMaxCommentLength}
/>
<ComposerWithSuggestions
ref={(ref) => {
Expand Down
Loading