From 6be5a3427d70d4878d093e0bca4b6b4ec3aecd3a Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Fri, 2 Jul 2021 20:14:11 +0530 Subject: [PATCH 1/4] fix: error when draft is null --- src/libs/OptionsListUtils.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 21130c3be2f8..c515b8ebe2dc 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -169,9 +169,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; @@ -215,7 +215,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), isPinned: lodashGet(report, 'isPinned', false), @@ -297,13 +297,13 @@ function getOptions(reports, personalDetails, draftComments, activeReportID, { return; } - const hasDraftComment = report - && draftComments - && lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, '').length > 0; + const reportDraftComment = report + && draftComments + && 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 From 1df1e4c6557bf235b8a423c32ec768092835dae2 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Fri, 2 Jul 2021 21:10:42 +0530 Subject: [PATCH 2/4] linting fixed --- src/libs/OptionsListUtils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index c515b8ebe2dc..c410f929bb95 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -298,8 +298,8 @@ function getOptions(reports, personalDetails, draftComments, activeReportID, { } const reportDraftComment = report - && draftComments - && lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, ''); + && draftComments + && lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, ''); const shouldFilterReportIfEmpty = !showReportsWithNoComments && report.lastMessageTimestamp === 0; const shouldFilterReportIfRead = hideReadReports && report.unreadActionCount === 0; From 33cb4fa500f036b6fa96f252ec44428e1eaa8e16 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Fri, 2 Jul 2021 22:23:13 +0530 Subject: [PATCH 3/4] fixed stalled login page --- src/libs/actions/Session.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Session.js b/src/libs/actions/Session.js index 891d9b01768d..05105c7af124 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, { From d189ca6385a202f3aeb7fb659e319e43e4c8d30d Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Wed, 7 Jul 2021 03:14:49 +0530 Subject: [PATCH 4/4] tweak --- src/libs/OptionsListUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index c410f929bb95..1516c836c89d 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -215,7 +215,7 @@ function createOption(personalDetailList, report, draftComments, { login: !hasMultipleParticipants ? personalDetail.login : null, reportID: report ? report.reportID : null, isUnread: report ? report.unreadActionCount > 0 : null, - hasDraftComment: !!reportDraftComment && reportDraftComment.length > 0, + hasDraftComment: reportDraftComment && reportDraftComment.length > 0, keyForList: report ? String(report.reportID) : personalDetail.login, searchText: getSearchText(report, personalDetailList), isPinned: lodashGet(report, 'isPinned', false),