diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js index d5442640e224..20337bd9802f 100644 --- a/src/libs/ReportActionsUtils.js +++ b/src/libs/ReportActionsUtils.js @@ -404,7 +404,7 @@ function getLastVisibleMessage(reportID, actionsToMerge = {}) { if (isReportMessageAttachment(message)) { return { lastMessageTranslationKey: CONST.TRANSLATION_KEYS.ATTACHMENT, - lastMessageText: CONST.TRANSLATION_KEYS.ATTACHMENT, + lastMessageText: CONST.ATTACHMENT_MESSAGE_TEXT, lastMessageHtml: CONST.TRANSLATION_KEYS.ATTACHMENT, }; } diff --git a/src/libs/isReportMessageAttachment.ts b/src/libs/isReportMessageAttachment.ts index 3f9e9d2de201..c257e1db4191 100644 --- a/src/libs/isReportMessageAttachment.ts +++ b/src/libs/isReportMessageAttachment.ts @@ -13,14 +13,14 @@ type IsReportMessageAttachmentParams = { * @param reportActionMessage report action's message as text, html and translationKey */ export default function isReportMessageAttachment({text, html, translationKey}: IsReportMessageAttachmentParams): boolean { - if (translationKey) { - return translationKey === CONST.TRANSLATION_KEYS.ATTACHMENT; - } - if (!text || !html) { return false; } + if (translationKey && text === CONST.ATTACHMENT_MESSAGE_TEXT) { + return translationKey === CONST.TRANSLATION_KEYS.ATTACHMENT; + } + const regex = new RegExp(` ${CONST.ATTACHMENT_SOURCE_ATTRIBUTE}="(.*)"`, 'i'); return text === CONST.ATTACHMENT_MESSAGE_TEXT && (!!html.match(regex) || html === CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML); }