From e550e731977a7072e7a4f0b319ccdc8fe325b901 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Wed, 6 Nov 2024 15:46:00 +0100 Subject: [PATCH 01/10] remove icons property from Report type --- src/libs/ReportUtils.ts | 1 + src/types/onyx/Report.ts | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index d8133991d62b..370558920617 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -520,6 +520,7 @@ type OptionData = { isConciergeChat?: boolean; isBold?: boolean; lastIOUCreationDate?: string; + icons?: Icon[]; } & Report; type OnyxDataTaskAssigneeChat = { diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 43c82cfdc227..a3c9f7243ac0 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -83,9 +83,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< /** Whether the report has a child task that is awaiting action from the current user */ hasOutstandingChildTask?: boolean; - /** List of icons for report participants */ - icons?: OnyxCommon.Icon[]; - /** Whether the user is not an admin of policyExpenseChat chat */ isOwnPolicyExpenseChat?: boolean; From bdd4bd1934059819660c419a138811255d1072c7 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Wed, 6 Nov 2024 15:53:53 +0100 Subject: [PATCH 02/10] remove lastMessageTimestamp from Report --- src/libs/DebugUtils.ts | 1 - src/types/onyx/Report.ts | 3 --- tests/utils/collections/optionData.ts | 1 - 3 files changed, 5 deletions(-) diff --git a/src/libs/DebugUtils.ts b/src/libs/DebugUtils.ts index d63758761c3c..a778e8b2c67a 100644 --- a/src/libs/DebugUtils.ts +++ b/src/libs/DebugUtils.ts @@ -44,7 +44,6 @@ type PropertyTypes = Array<'string' | 'number' | 'object' | 'boolean' | 'undefin const OPTIONAL_BOOLEAN_STRINGS = ['true', 'false', 'undefined']; const REPORT_NUMBER_PROPERTIES: Array = [ - 'lastMessageTimestamp', 'lastReadSequenceNumber', 'managerID', 'lastActorAccountID', diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index a3c9f7243ac0..4987ebb43644 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -95,9 +95,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< /** The text of the last message on the report */ lastMessageText?: string; - /** The timestamp of the last message on the report */ - lastMessageTimestamp?: number; - /** The time of the last message on the report */ lastVisibleActionCreated?: string; diff --git a/tests/utils/collections/optionData.ts b/tests/utils/collections/optionData.ts index a589daf8a913..d37b5cccb382 100644 --- a/tests/utils/collections/optionData.ts +++ b/tests/utils/collections/optionData.ts @@ -26,7 +26,6 @@ export default function createRandomOptionData(index: number): OptionData { hasOutstandingChildRequest: randBoolean(), isOwnPolicyExpenseChat: randBoolean(), lastMessageText: randWord(), - lastMessageTimestamp: Date.now(), lastVisibleActionCreated: new Date().toISOString(), lastReadCreated: new Date().toISOString(), lastReadTime: new Date().toISOString(), From f9bb3669076ddd2fb4be7f6ee188d0c00a7bd5b1 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Wed, 6 Nov 2024 15:56:00 +0100 Subject: [PATCH 03/10] remove lastReadCreated from Report --- src/libs/DebugUtils.ts | 4 +--- src/types/onyx/Report.ts | 3 --- tests/utils/collections/optionData.ts | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/libs/DebugUtils.ts b/src/libs/DebugUtils.ts index a778e8b2c67a..6080d42bed4d 100644 --- a/src/libs/DebugUtils.ts +++ b/src/libs/DebugUtils.ts @@ -73,9 +73,7 @@ const REPORT_BOOLEAN_PROPERTIES: Array = [ 'selected', ] satisfies Array; -const REPORT_DATE_PROPERTIES: Array = ['lastVisibleActionCreated', 'lastReadCreated', 'lastReadTime', 'lastMentionedTime', 'lastVisibleActionLastModified'] satisfies Array< - keyof Report ->; +const REPORT_DATE_PROPERTIES: Array = ['lastVisibleActionCreated', 'lastReadTime', 'lastMentionedTime', 'lastVisibleActionLastModified'] satisfies Array; const REPORT_REQUIRED_PROPERTIES: Array = ['reportID'] satisfies Array; diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 4987ebb43644..1397bb6ddfe0 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -98,9 +98,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< /** The time of the last message on the report */ lastVisibleActionCreated?: string; - /** The time of the last read of the report */ - lastReadCreated?: string; - /** The time when user read the last message */ lastReadTime?: string; diff --git a/tests/utils/collections/optionData.ts b/tests/utils/collections/optionData.ts index d37b5cccb382..cfcc84391194 100644 --- a/tests/utils/collections/optionData.ts +++ b/tests/utils/collections/optionData.ts @@ -27,7 +27,6 @@ export default function createRandomOptionData(index: number): OptionData { isOwnPolicyExpenseChat: randBoolean(), lastMessageText: randWord(), lastVisibleActionCreated: new Date().toISOString(), - lastReadCreated: new Date().toISOString(), lastReadTime: new Date().toISOString(), lastReadSequenceNumber: randNumber(), lastMentionedTime: randBoolean() ? new Date().toISOString() : null, From f0b178ba2252514716ebed56c745b9548470cfd6 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Wed, 6 Nov 2024 16:02:03 +0100 Subject: [PATCH 04/10] remove openOnAdminRoom from Report type --- src/libs/DebugUtils.ts | 1 - src/types/onyx/Report.ts | 3 --- 2 files changed, 4 deletions(-) diff --git a/src/libs/DebugUtils.ts b/src/libs/DebugUtils.ts index 6080d42bed4d..be710c99e159 100644 --- a/src/libs/DebugUtils.ts +++ b/src/libs/DebugUtils.ts @@ -62,7 +62,6 @@ const REPORT_BOOLEAN_PROPERTIES: Array = [ 'isPinned', 'hasParentAccess', 'isDeletedParentAction', - 'openOnAdminRoom', 'isOptimisticReport', 'isWaitingOnBankAccount', 'isCancelledIOU', diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 1397bb6ddfe0..9aba811de42e 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -152,9 +152,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< /** The report type */ type?: string; - /** If the admin room should be opened */ - openOnAdminRoom?: boolean; - /** The report visibility */ visibility?: RoomVisibility; From 4e3d228fcdc168267251f8d0bb060456fa41ac78 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Thu, 7 Nov 2024 11:42:30 +0100 Subject: [PATCH 05/10] remove errors from Report type --- src/libs/ReportUtils.ts | 2 -- src/types/onyx/Report.ts | 3 --- 2 files changed, 5 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 370558920617..6a1b4e669594 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6458,13 +6458,11 @@ function getAllReportActionsErrorsAndReportActionThatRequiresAttention(report: O * Get an object of error messages keyed by microtime by combining all error objects related to the report. */ function getAllReportErrors(report: OnyxEntry, reportActions: OnyxEntry): Errors { - const reportErrors = report?.errors ?? {}; const reportErrorFields = report?.errorFields ?? {}; const {errors: reportActionErrors} = getAllReportActionsErrorsAndReportActionThatRequiresAttention(report, reportActions); // All error objects related to the report. Each object in the sources contains error messages keyed by microtime const errorSources = { - reportErrors, ...reportErrorFields, ...reportActionErrors, }; diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 9aba811de42e..8bb080ebe1d4 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -209,9 +209,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< /** For expense reports, this is the currency of the expense */ currency?: string; - /** Collection of errors to be shown to the user */ - errors?: OnyxCommon.Errors; - /** Collection of errors that exist in report fields */ errorFields?: OnyxCommon.ErrorFields; From 889a39343bdb5dffb76c0e65a6e3106582d08b65 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Thu, 7 Nov 2024 11:43:05 +0100 Subject: [PATCH 06/10] remove isLastMessageDeletedParentAction from Report type --- src/libs/DebugUtils.ts | 1 - src/types/onyx/Report.ts | 3 --- tests/utils/collections/optionData.ts | 1 - tests/utils/collections/reports.ts | 1 - 4 files changed, 6 deletions(-) diff --git a/src/libs/DebugUtils.ts b/src/libs/DebugUtils.ts index be710c99e159..49969076f4f7 100644 --- a/src/libs/DebugUtils.ts +++ b/src/libs/DebugUtils.ts @@ -65,7 +65,6 @@ const REPORT_BOOLEAN_PROPERTIES: Array = [ 'isOptimisticReport', 'isWaitingOnBankAccount', 'isCancelledIOU', - 'isLastMessageDeletedParentAction', 'isHidden', 'isChatRoom', 'isLoadingPrivateNotes', diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 8bb080ebe1d4..fafda5367296 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -218,9 +218,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< /** Whether the report is cancelled */ isCancelledIOU?: boolean; - /** Whether the last message was deleted */ - isLastMessageDeletedParentAction?: boolean; - /** The ID of the IOU report */ iouReportID?: string; diff --git a/tests/utils/collections/optionData.ts b/tests/utils/collections/optionData.ts index cfcc84391194..e7ef9fcbaa8e 100644 --- a/tests/utils/collections/optionData.ts +++ b/tests/utils/collections/optionData.ts @@ -42,7 +42,6 @@ export default function createRandomOptionData(index: number): OptionData { statusNum: rand(Object.values(CONST.REPORT.STATUS_NUM)), type: rand(Object.values(CONST.REPORT.TYPE)), visibility: rand(Object.values(CONST.REPORT.VISIBILITY)), - isLastMessageDeletedParentAction: randBoolean(), isCancelledIOU: randBoolean(), iouReportID: `iou_${index}`, iouReportAmount: randNumber({min: 0, max: 1000}), diff --git a/tests/utils/collections/reports.ts b/tests/utils/collections/reports.ts index 60908e72c2de..cf8e85893996 100644 --- a/tests/utils/collections/reports.ts +++ b/tests/utils/collections/reports.ts @@ -13,7 +13,6 @@ export default function createRandomReport(index: number): Report { isOptimisticReport: randBoolean(), isOwnPolicyExpenseChat: randBoolean(), isWaitingOnBankAccount: randBoolean(), - isLastMessageDeletedParentAction: randBoolean(), policyID: index.toString(), reportName: randWord(), }; From 05971684c74f83bddce6fb0c80f0188e4bfa00ea Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Thu, 7 Nov 2024 11:44:42 +0100 Subject: [PATCH 07/10] remove iouReportAmount from Report type --- src/libs/DebugUtils.ts | 1 - src/libs/ReportUtils.ts | 1 + src/types/onyx/Report.ts | 3 --- tests/utils/collections/optionData.ts | 1 - 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/libs/DebugUtils.ts b/src/libs/DebugUtils.ts index 49969076f4f7..1c4b4653671b 100644 --- a/src/libs/DebugUtils.ts +++ b/src/libs/DebugUtils.ts @@ -50,7 +50,6 @@ const REPORT_NUMBER_PROPERTIES: Array = [ 'ownerAccountID', 'total', 'unheldTotal', - 'iouReportAmount', 'nonReimbursableTotal', ] satisfies Array; diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 6a1b4e669594..6b77f18bed7a 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -521,6 +521,7 @@ type OptionData = { isBold?: boolean; lastIOUCreationDate?: string; icons?: Icon[]; + iouReportAmount?: number; } & Report; type OnyxDataTaskAssigneeChat = { diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index fafda5367296..9d40f484a807 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -221,9 +221,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< /** The ID of the IOU report */ iouReportID?: string; - /** Total amount of money owed for IOU report */ - iouReportAmount?: number; - /** The ID of the preexisting report (it is possible that we optimistically created a Report for which a report already exists) */ preexistingReportID?: string; diff --git a/tests/utils/collections/optionData.ts b/tests/utils/collections/optionData.ts index e7ef9fcbaa8e..2bf0c841b985 100644 --- a/tests/utils/collections/optionData.ts +++ b/tests/utils/collections/optionData.ts @@ -44,7 +44,6 @@ export default function createRandomOptionData(index: number): OptionData { visibility: rand(Object.values(CONST.REPORT.VISIBILITY)), isCancelledIOU: randBoolean(), iouReportID: `iou_${index}`, - iouReportAmount: randNumber({min: 0, max: 1000}), currency: randWord(), isWaitingOnBankAccount: randBoolean(), lastVisibleActionLastModified: new Date().toISOString(), From db5bd24b0004bf53ad65c3687cb65bcdf92558ee Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Thu, 7 Nov 2024 11:47:50 +0100 Subject: [PATCH 08/10] remove visibleChatMemberAccountIDs from Report type --- src/libs/DebugUtils.ts | 3 --- src/types/form/DebugReportForm.ts | 1 - src/types/onyx/Report.ts | 3 --- 3 files changed, 7 deletions(-) diff --git a/src/libs/DebugUtils.ts b/src/libs/DebugUtils.ts index 1c4b4653671b..6b3b2a70ede0 100644 --- a/src/libs/DebugUtils.ts +++ b/src/libs/DebugUtils.ts @@ -496,9 +496,6 @@ function validateReportDraftProperty(key: keyof Report, value: string) { if (key === 'pendingFields') { return validateObject(value, {}); } - if (key === 'visibleChatMemberAccountIDs') { - return validateArray(value, 'number'); - } if (key === 'participantAccountIDs') { return validateArray(value, 'number'); } diff --git a/src/types/form/DebugReportForm.ts b/src/types/form/DebugReportForm.ts index c3308de02122..0aab2d9eeaf3 100644 --- a/src/types/form/DebugReportForm.ts +++ b/src/types/form/DebugReportForm.ts @@ -44,7 +44,6 @@ const INPUT_IDS = { TOTAL: 'total', TYPE: 'type', UNHELD_TOTAL: 'unheldTotal', - VISIBLE_CHAT_MEMBER_ACCOUNT_IDS: 'visibleChatMemberAccountIDs', WELCOME_MESSAGE: 'welcomeMessage', WRITE_CAPABILITY: 'writeCapability', } as const; diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 9d40f484a807..6f028ec2dd78 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -278,9 +278,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< /** Participant account id's */ participantAccountIDs?: number[]; - - /** Visible chat member account id's */ - visibleChatMemberAccountIDs?: number[]; }, PolicyReportField['fieldID'] >; From a7c03d57dff59a8d983b48140d84e2bc55bc0f73 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Thu, 7 Nov 2024 14:03:17 +0100 Subject: [PATCH 09/10] Revert "remove errors from Report type" This reverts commit 4e3d228fcdc168267251f8d0bb060456fa41ac78. --- src/libs/ReportUtils.ts | 2 ++ src/types/onyx/Report.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 6b77f18bed7a..4cc8ddb70059 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6459,11 +6459,13 @@ function getAllReportActionsErrorsAndReportActionThatRequiresAttention(report: O * Get an object of error messages keyed by microtime by combining all error objects related to the report. */ function getAllReportErrors(report: OnyxEntry, reportActions: OnyxEntry): Errors { + const reportErrors = report?.errors ?? {}; const reportErrorFields = report?.errorFields ?? {}; const {errors: reportActionErrors} = getAllReportActionsErrorsAndReportActionThatRequiresAttention(report, reportActions); // All error objects related to the report. Each object in the sources contains error messages keyed by microtime const errorSources = { + reportErrors, ...reportErrorFields, ...reportActionErrors, }; diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 6f028ec2dd78..1dffac0701ea 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -209,6 +209,9 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< /** For expense reports, this is the currency of the expense */ currency?: string; + /** Collection of errors to be shown to the user */ + errors?: OnyxCommon.Errors; + /** Collection of errors that exist in report fields */ errorFields?: OnyxCommon.ErrorFields; From 96bcfa7d2810f4ef0fc35495a68769360d0d0151 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Thu, 7 Nov 2024 14:19:29 +0100 Subject: [PATCH 10/10] remove unused input id --- src/types/form/DebugReportForm.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/types/form/DebugReportForm.ts b/src/types/form/DebugReportForm.ts index 0aab2d9eeaf3..b16f3b93f7f0 100644 --- a/src/types/form/DebugReportForm.ts +++ b/src/types/form/DebugReportForm.ts @@ -93,7 +93,6 @@ type DebugReportForm = Form< [INPUT_IDS.TOTAL]: string; [INPUT_IDS.TYPE]: ValueOf; [INPUT_IDS.UNHELD_TOTAL]: string; - [INPUT_IDS.VISIBLE_CHAT_MEMBER_ACCOUNT_IDS]: string; [INPUT_IDS.WELCOME_MESSAGE]: string; [INPUT_IDS.WRITE_CAPABILITY]: ValueOf; }