From 649d1326aa0d27d253efab69aaa5fdd1d36fc0f4 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Fri, 22 Nov 2024 15:56:01 +0100 Subject: [PATCH 1/2] remove isHidden property from report --- src/libs/DebugUtils.ts | 3 --- src/libs/ReportUtils.ts | 4 ---- src/libs/actions/Task.ts | 18 ++++++++++++------ src/types/onyx/Report.ts | 3 --- src/types/utils/whitelistedReportKeys.ts | 1 - 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/libs/DebugUtils.ts b/src/libs/DebugUtils.ts index 671fb03f268b..740feab4569f 100644 --- a/src/libs/DebugUtils.ts +++ b/src/libs/DebugUtils.ts @@ -480,8 +480,6 @@ function validateReportDraftProperty(key: keyof Report, value: string) { case 'isOptimisticReport': case 'isWaitingOnBankAccount': case 'isCancelledIOU': - case 'isHidden': - return validateBoolean(value); case 'lastReadSequenceNumber': case 'managerID': case 'lastActorAccountID': @@ -621,7 +619,6 @@ function validateReportDraftProperty(key: keyof Report, value: string) { iouReportID: CONST.RED_BRICK_ROAD_PENDING_ACTION, preexistingReportID: CONST.RED_BRICK_ROAD_PENDING_ACTION, nonReimbursableTotal: CONST.RED_BRICK_ROAD_PENDING_ACTION, - isHidden: CONST.RED_BRICK_ROAD_PENDING_ACTION, pendingChatMembers: CONST.RED_BRICK_ROAD_PENDING_ACTION, fieldList: CONST.RED_BRICK_ROAD_PENDING_ACTION, permissions: CONST.RED_BRICK_ROAD_PENDING_ACTION, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 40749c525a38..db4e8c2faa6d 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -329,7 +329,6 @@ type OptimisticChatReport = Pick< | 'writeCapability' | 'avatarUrl' | 'invoiceReceiver' - | 'isHidden' > & { isOptimisticReport: true; }; @@ -6517,8 +6516,6 @@ function reasonForReportToBeInOptionList({ !report?.reportID || !report?.type || report?.reportName === undefined || - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - report?.isHidden || (!report?.participants && // We omit sending back participants for chat rooms when searching for reports since they aren't needed to display the results and can get very large. // So we allow showing rooms with no participants–in any other circumstances we should never have these reports with no participants in Onyx. @@ -7399,7 +7396,6 @@ function getTaskAssigneeChatOnyxData( pendingFields: { createChat: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, }, - isHidden: false, }, }, { diff --git a/src/libs/actions/Task.ts b/src/libs/actions/Task.ts index aec6c4bd9d30..ea87f5dd5cc6 100644 --- a/src/libs/actions/Task.ts +++ b/src/libs/actions/Task.ts @@ -776,13 +776,19 @@ function setAssigneeChatReport(chatReport: OnyxTypes.Report) { } function setNewOptimisticAssignee(assigneeLogin: string, assigneeAccountID: number) { - const report: ReportUtils.OptimisticChatReport = ReportUtils.buildOptimisticChatReport([assigneeAccountID, currentUserAccountID]); + const report: ReportUtils.OptimisticChatReport = ReportUtils.buildOptimisticChatReport( + [assigneeAccountID, currentUserAccountID], + '', + undefined, + CONST.POLICY.OWNER_EMAIL_FAKE, + CONST.POLICY.OWNER_ACCOUNT_ID_FAKE, + false, + '', + undefined, + undefined, + CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, + ); - // When assigning a task to a new user, by default we share the task in their DM - // However, the DM doesn't exist yet - and will be created optimistically once the task is created - // We don't want to show the new DM yet, because if you select an assignee and then change the assignee, the previous DM will still be shown - // So here, we create it optimistically to share it with the assignee, but we have to hide it until the task is created - report.isHidden = true; Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report); const optimisticPersonalDetailsListAction: OnyxTypes.PersonalDetails = { diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 0fec22cd9e34..42be2a8c3613 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -211,9 +211,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< /** If the report contains nonreimbursable expenses, send the nonreimbursable total */ nonReimbursableTotal?: number; - /** Whether the report is hidden from options list */ - isHidden?: boolean; - /** Collection of participant private notes, indexed by their accountID */ privateNotes?: Record; diff --git a/src/types/utils/whitelistedReportKeys.ts b/src/types/utils/whitelistedReportKeys.ts index 32aa0797d0f8..d556a51cd3de 100644 --- a/src/types/utils/whitelistedReportKeys.ts +++ b/src/types/utils/whitelistedReportKeys.ts @@ -54,7 +54,6 @@ type WhitelistedReport = OnyxCommon.OnyxValueWithOfflineFeedback< iouReportID: unknown; preexistingReportID: unknown; nonReimbursableTotal: unknown; - isHidden: unknown; privateNotes: unknown; pendingChatMembers: unknown; fieldList: unknown; From 6a9a7697b0ebe763c5adf0eefe5192a5c5293ef0 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Mon, 25 Nov 2024 08:29:53 +0100 Subject: [PATCH 2/2] fix tests --- src/libs/DebugUtils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/DebugUtils.ts b/src/libs/DebugUtils.ts index 740feab4569f..aa87f28bef4b 100644 --- a/src/libs/DebugUtils.ts +++ b/src/libs/DebugUtils.ts @@ -480,6 +480,7 @@ function validateReportDraftProperty(key: keyof Report, value: string) { case 'isOptimisticReport': case 'isWaitingOnBankAccount': case 'isCancelledIOU': + return validateBoolean(value); case 'lastReadSequenceNumber': case 'managerID': case 'lastActorAccountID':