Skip to content

Commit

Permalink
Fix: User is able to send message with max character limit
Browse files Browse the repository at this point in the history
  • Loading branch information
nyomanjyotisa committed Oct 9, 2024
1 parent 3a6676e commit c7227f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
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

0 comments on commit c7227f8

Please sign in to comment.