Skip to content

Commit

Permalink
adding condition
Browse files Browse the repository at this point in the history
  • Loading branch information
pradeepmdk committed Sep 8, 2023
1 parent b119f9a commit 8792382
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/libs/isReportMessageAttachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ 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);
}

0 comments on commit 8792382

Please sign in to comment.