Skip to content

Commit

Permalink
Merge pull request #50487 from nyomanjyotisa/issue-48888
Browse files Browse the repository at this point in the history
Fix: Chat - User is able to send message with max character limit
  • Loading branch information
jasperhuangg authored Oct 16, 2024
2 parents 4bad885 + 600357c commit d1d2264
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 @@ -88,6 +88,8 @@ type AttachmentPickerWithMenuItemsProps = {

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

shouldDisableAttachmentItem?: boolean;
};

/**
Expand All @@ -112,6 +114,7 @@ function AttachmentPickerWithMenuItems({
onItemSelected,
actionButtonRef,
raiseIsScrollLikelyLayoutTriggered,
shouldDisableAttachmentItem,
}: AttachmentPickerWithMenuItemsProps) {
const isFocused = useIsFocused();
const theme = useTheme();
Expand Down Expand Up @@ -237,6 +240,7 @@ function AttachmentPickerWithMenuItems({
{
icon: Expensicons.Paperclip,
text: translate('reportActionCompose.addAttachment'),
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 d1d2264

Please sign in to comment.