diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index b727b27b1b57..8f69651afc7b 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -177,9 +177,9 @@ function createOption(personalDetailList, report, draftComments, { }) { const hasMultipleParticipants = personalDetailList.length > 1; const personalDetail = personalDetailList[0]; - const hasDraftComment = report + const reportDraftComment = report && draftComments - && lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, '').length > 0; + && lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, ''); const hasOutstandingIOU = lodashGet(report, 'hasOutstandingIOU', false); const lastActorDetails = report ? _.find(personalDetailList, {login: report.lastActorEmail}) : null; @@ -223,7 +223,7 @@ function createOption(personalDetailList, report, draftComments, { login: !hasMultipleParticipants ? personalDetail.login : null, reportID: report ? report.reportID : null, isUnread: report ? report.unreadActionCount > 0 : null, - hasDraftComment, + hasDraftComment: reportDraftComment && reportDraftComment.length > 0, keyForList: report ? String(report.reportID) : personalDetail.login, searchText: getSearchText(report, personalDetailList, isDefaultChatRoom), isPinned: lodashGet(report, 'isPinned', false), @@ -307,13 +307,13 @@ function getOptions(reports, personalDetails, draftComments, activeReportID, { return; } - const hasDraftComment = report + const reportDraftComment = report && draftComments - && lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, '').length > 0; + && lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, ''); const shouldFilterReportIfEmpty = !showReportsWithNoComments && report.lastMessageTimestamp === 0; const shouldFilterReportIfRead = hideReadReports && report.unreadActionCount === 0; - const shouldShowReportIfHasDraft = showReportsWithDrafts && hasDraftComment; + const shouldShowReportIfHasDraft = showReportsWithDrafts && reportDraftComment && reportDraftComment.length > 0; const shouldFilterReport = shouldFilterReportIfEmpty || shouldFilterReportIfRead; if (report.reportID !== activeReportID && !report.isPinned diff --git a/src/libs/actions/Session.js b/src/libs/actions/Session.js index e69f34980f3f..bb537ee7ea6f 100644 --- a/src/libs/actions/Session.js +++ b/src/libs/actions/Session.js @@ -105,7 +105,7 @@ function resendValidationLink(login = credentials.login) { function fetchAccountDetails(login) { Onyx.merge(ONYXKEYS.ACCOUNT, {...CONST.DEFAULT_ACCOUNT_DATA, loading: true}); - API.GetAccountStatus({email: login}) + API.GetAccountStatus({email: login, forceNetworkRequest: true}) .then((response) => { if (response.jsonCode === 200) { Onyx.merge(ONYXKEYS.CREDENTIALS, {