Skip to content

Commit

Permalink
Merge pull request #26850 from pradeepmdk/fix/24246-attachement-no-ac…
Browse files Browse the repository at this point in the history
…tivity

After deleting an attachment, the LHN shows '[Attachment]' instead of 'No activity yet' until you delete one more message
  • Loading branch information
Li357 authored Sep 13, 2023
2 parents 7deca7a + 03522c3 commit 4ff85db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/libs/ReportActionsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
Expand Down
8 changes: 4 additions & 4 deletions src/libs/isReportMessageAttachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 4ff85db

Please sign in to comment.