Skip to content

Commit

Permalink
Merge pull request #36950 from FitseTLT/fix-lhn-bold-issue-for-delete…
Browse files Browse the repository at this point in the history
…d-message

Fix - LHN - When you delete a message from a room, the conversation in the members remains bolded
  • Loading branch information
tylerkaraszewski authored Feb 22, 2024
2 parents 6a63e02 + e584f66 commit 3e77445
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ function getOptionData({
result.policyID = report.policyID;
result.stateNum = report.stateNum;
result.statusNum = report.statusNum;
result.isUnread = ReportUtils.isUnread(report);
// When the only message of a report is deleted lastVisibileActionCreated is not reset leading to wrongly
// setting it Unread so we add additional condition here to avoid empty chat LHN from being bold.
result.isUnread = ReportUtils.isUnread(report) && !!report.lastActorAccountID;
result.isUnreadWithMention = ReportUtils.isUnreadWithMention(report);
result.hasDraftComment = report.hasDraft;
result.isPinned = report.isPinned;
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/UnreadIndicatorsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ function signInAndGetAppWithUnreadChat() {
lastVisibleActionCreated: reportAction9CreatedDate,
lastMessageText: 'Test',
participantAccountIDs: [USER_B_ACCOUNT_ID],
lastActorAccountID: USER_B_ACCOUNT_ID,
type: CONST.REPORT.TYPE.CHAT,
});
const createdReportActionID = NumberUtils.rand64();
Expand Down Expand Up @@ -388,6 +389,7 @@ describe('Unread Indicators', () => {
lastReadTime: '',
lastVisibleActionCreated: DateUtils.getDBTime(utcToZonedTime(NEW_REPORT_FIST_MESSAGE_CREATED_DATE, 'UTC').valueOf()),
lastMessageText: 'Comment 1',
lastActorAccountID: USER_C_ACCOUNT_ID,
participantAccountIDs: [USER_C_ACCOUNT_ID],
type: CONST.REPORT.TYPE.CHAT,
},
Expand Down

0 comments on commit 3e77445

Please sign in to comment.