From 8603a7c77ff42479de2c6c3c789e014ed008c5f1 Mon Sep 17 00:00:00 2001 From: VH Date: Mon, 31 Jul 2023 23:50:40 +0700 Subject: [PATCH 1/3] Always show assigned task that is still open in LHN --- src/libs/ReportUtils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 0050aa4fc989..471e38cfe4e9 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1094,6 +1094,10 @@ function isWaitingForIOUActionFromCurrentUser(report, allReportsDict = null) { return false; } +function isWaitingForTaskCompleteFromAssignee(report) { + return isTaskReport(report) && isTaskAssignee(report) && isOpenTaskReport(report); +} + /** * @param {Object} report * @param {Object} allReportsDict @@ -2273,9 +2277,9 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, iouRep return true; } - // Include reports if they have a draft, are pinned, or have an outstanding IOU + // Include reports if they have a draft, are pinned, have an outstanding IOU or assigned to an open task // These are always relevant to the user no matter what view mode the user prefers - if (report.hasDraft || report.isPinned || isWaitingForIOUActionFromCurrentUser(report, iouReports)) { + if (report.hasDraft || report.isPinned || isWaitingForIOUActionFromCurrentUser(report, iouReports) || isWaitingForTaskCompleteFromAssignee(report)) { return true; } From 681fd4abd1f39fe5b0831111109c559aa484e33e Mon Sep 17 00:00:00 2001 From: Vinh Hoang Date: Tue, 1 Aug 2023 22:45:58 +0700 Subject: [PATCH 2/3] Update comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Arkadiusz Chrabąszczewski --- src/libs/ReportUtils.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 471e38cfe4e9..5dca5112447b 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2277,8 +2277,7 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, iouRep return true; } - // Include reports if they have a draft, are pinned, have an outstanding IOU or assigned to an open task - // These are always relevant to the user no matter what view mode the user prefers + // Include reports that are relevant to the user in any view mode. Criteria include having a draft, being pinned, having an outstanding IOU, or being assigned to an open task. if (report.hasDraft || report.isPinned || isWaitingForIOUActionFromCurrentUser(report, iouReports) || isWaitingForTaskCompleteFromAssignee(report)) { return true; } From 249206608eeb12f28a6f79d75c401dccf5eaeedf Mon Sep 17 00:00:00 2001 From: VH Date: Tue, 1 Aug 2023 23:02:15 +0700 Subject: [PATCH 3/3] Resolve format on save --- src/libs/ReportUtils.js | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 6d7c57807ab9..bfb394fa527b 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -700,17 +700,17 @@ function getRoomWelcomeMessage(report) { welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfArchivedRoomPartOne'); welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfArchivedRoomPartTwo'); } else if (isDomainRoom(report)) { - welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryDomainRoomPartOne', { domainRoom: report.reportName }); + welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryDomainRoomPartOne', {domainRoom: report.reportName}); welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryDomainRoomPartTwo'); } else if (isAdminRoom(report)) { - welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminRoomPartOne', { workspaceName }); + welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminRoomPartOne', {workspaceName}); welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminRoomPartTwo'); } else if (isAdminsOnlyPostingRoom(report)) { welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminOnlyPostingRoomPartOne'); - welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminOnlyPostingRoomPartTwo', { workspaceName }); + welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminOnlyPostingRoomPartTwo', {workspaceName}); } else if (isAnnounceRoom(report)) { - welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAnnounceRoomPartOne', { workspaceName }); - welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAnnounceRoomPartTwo', { workspaceName }); + welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAnnounceRoomPartOne', {workspaceName}); + welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAnnounceRoomPartTwo', {workspaceName}); } else { // Message for user created rooms or other room types. welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryUserRoomPartOne'); @@ -754,12 +754,12 @@ function canShowReportRecipientLocalTime(personalDetails, report, accountID) { const isReportParticipantValidated = lodashGet(reportRecipient, 'validated', false); return Boolean( !hasMultipleParticipants && - !isChatRoom(report) && - !isPolicyExpenseChat(report) && - reportRecipient && - reportRecipientTimezone && - reportRecipientTimezone.selected && - isReportParticipantValidated, + !isChatRoom(report) && + !isPolicyExpenseChat(report) && + reportRecipient && + reportRecipientTimezone && + reportRecipientTimezone.selected && + isReportParticipantValidated, ); } @@ -1062,7 +1062,7 @@ function getMoneyRequestAction(reportAction = {}) { comment = lodashGet(originalMessage, 'IOUDetails.comment', ''); } - return { amount, currency, comment }; + return {amount, currency, comment}; } /** @@ -1170,14 +1170,14 @@ function getPolicyExpenseChatName(report, policy = undefined) { function getMoneyRequestReportName(report, policy = undefined) { const formattedAmount = CurrencyUtils.convertToDisplayString(getMoneyRequestTotal(report), report.currency); const payerName = isExpenseReport(report) ? getPolicyName(report, false, policy) : getDisplayNameForParticipant(report.managerID); - const payerPaidAmountMesssage = Localize.translateLocal('iou.payerPaidAmount', { payer: payerName, amount: formattedAmount }); + const payerPaidAmountMesssage = Localize.translateLocal('iou.payerPaidAmount', {payer: payerName, amount: formattedAmount}); if (report.isWaitingOnBankAccount) { return `${payerPaidAmountMesssage} • ${Localize.translateLocal('iou.pending')}`; } if (report.hasOutstandingIOU) { - return Localize.translateLocal('iou.payerOwesAmount', { payer: payerName, amount: formattedAmount }); + return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount}); } return payerPaidAmountMesssage; @@ -1228,15 +1228,15 @@ function getReportPreviewMessage(report, reportAction = {}) { } else if (reportActionMessage.match(/ using Expensify$/)) { translatePhraseKey = 'iou.paidUsingExpensifyWithAmount'; } - return Localize.translateLocal(translatePhraseKey, { amount: formattedAmount }); + return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount}); } if (report.isWaitingOnBankAccount) { const submitterDisplayName = getDisplayNameForParticipant(report.ownerAccountID, true); - return Localize.translateLocal('iou.waitingOnBankAccount', { submitterDisplayName }); + return Localize.translateLocal('iou.waitingOnBankAccount', {submitterDisplayName}); } - return Localize.translateLocal('iou.payerOwesAmount', { payer: payerName, amount: formattedAmount }); + return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount}); } /** @@ -1358,12 +1358,12 @@ function getChatRoomSubtitle(report) { function getParentNavigationSubtitle(report) { if (isThread(report)) { const parentReport = lodashGet(allReports, [`${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`]); - const { rootReportName, workspaceName } = getRootReportAndWorkspaceName(parentReport); + const {rootReportName, workspaceName} = getRootReportAndWorkspaceName(parentReport); if (_.isEmpty(rootReportName)) { return ''; } - return Localize.translateLocal('threads.parentNavigationSummary', { rootReportName, workspaceName }); + return Localize.translateLocal('threads.parentNavigationSummary', {rootReportName, workspaceName}); } return ''; } @@ -1660,7 +1660,7 @@ function buildOptimisticExpenseReport(chatReportID, policyID, payeeAccountID, to */ function getIOUReportActionMessage(type, total, comment, currency, paymentType = '', isSettlingUp = false) { const currencyUnit = CurrencyUtils.getCurrencyUnit(currency); - const amount = NumberFormatUtils.format(preferredLocale, Math.abs(total) / currencyUnit, { style: 'currency', currency }); + const amount = NumberFormatUtils.format(preferredLocale, Math.abs(total) / currencyUnit, {style: 'currency', currency}); let paymentMethodMessage; switch (paymentType) { case CONST.IOU.PAYMENT_TYPE.ELSEWHERE: @@ -1734,7 +1734,7 @@ function buildOptimisticIOUReportAction(type, amount, currency, comment, partici _.each(['amount', 'comment', 'currency'], (key) => { delete originalMessage[key]; }); - originalMessage.IOUDetails = { amount, comment, currency }; + originalMessage.IOUDetails = {amount, comment, currency}; originalMessage.paymentType = paymentType; } @@ -2511,7 +2511,7 @@ function getRouteFromLink(url) { */ function getReportIDFromLink(url) { const route = getRouteFromLink(url); - const { reportID, isSubReportPageRoute } = ROUTES.parseReportRouteParams(route); + const {reportID, isSubReportPageRoute} = ROUTES.parseReportRouteParams(route); if (isSubReportPageRoute) { // We allow the Sub-Report deep link routes (settings, details, etc.) to be handled by their respective component pages return ''; @@ -2740,7 +2740,7 @@ function getReportOfflinePendingActionAndErrors(report) { // simply looking up the first truthy value for each case will get the relevant property if it's set. const addWorkspaceRoomOrChatPendingAction = lodashGet(report, 'pendingFields.addWorkspaceRoom') || lodashGet(report, 'pendingFields.createChat'); const addWorkspaceRoomOrChatErrors = lodashGet(report, 'errorFields.addWorkspaceRoom') || lodashGet(report, 'errorFields.createChat'); - return { addWorkspaceRoomOrChatPendingAction, addWorkspaceRoomOrChatErrors }; + return {addWorkspaceRoomOrChatPendingAction, addWorkspaceRoomOrChatErrors}; } /**