diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index bd314757e89c..5c2a25e1d328 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -703,8 +703,8 @@ function getAllReportActions(reportID: string): ReportActions { function isReportActionAttachment(reportAction: OnyxEntry): boolean { const message = reportAction?.message?.[0]; - if (reportAction && 'isAttachment' in reportAction) { - return reportAction.isAttachment ?? false; + if (reportAction && ('isAttachment' in reportAction || 'attachmentInfo' in reportAction)) { + return reportAction?.isAttachment ?? !!reportAction?.attachmentInfo ?? false; } if (message) { diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index d202a6440a5d..8813501e2b3f 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2199,7 +2199,7 @@ function canEditReportAction(reportAction: OnyxEntry): boolean { reportAction?.actorAccountID === currentUserAccountID && isCommentOrIOU && canEditMoneyRequest(reportAction) && // Returns true for non-IOU actions - !isReportMessageAttachment(reportAction?.message?.[0] ?? {type: '', text: ''}) && + !ReportActionsUtils.isReportActionAttachment(reportAction) && !ReportActionsUtils.isDeletedAction(reportAction) && !ReportActionsUtils.isCreatedTaskReportAction(reportAction) && reportAction?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, diff --git a/src/libs/isReportMessageAttachment.ts b/src/libs/isReportMessageAttachment.ts index df8a589f7bdc..fd03adcffd93 100644 --- a/src/libs/isReportMessageAttachment.ts +++ b/src/libs/isReportMessageAttachment.ts @@ -1,3 +1,4 @@ +import Str from 'expensify-common/lib/str'; import CONST from '@src/CONST'; import type {Message} from '@src/types/onyx/ReportAction'; @@ -17,5 +18,5 @@ export default function isReportMessageAttachment({text, html, translationKey}: } const regex = new RegExp(` ${CONST.ATTACHMENT_SOURCE_ATTRIBUTE}="(.*)"`, 'i'); - return text === CONST.ATTACHMENT_MESSAGE_TEXT && (!!html.match(regex) || html === CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML); + return (text === CONST.ATTACHMENT_MESSAGE_TEXT || !!Str.isVideo(text)) && (!!html.match(regex) || html === CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML); }