Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NO QA] chore: remove unused properties from Report type #52182

Merged
11 changes: 1 addition & 10 deletions src/libs/DebugUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ type PropertyTypes = Array<'string' | 'number' | 'object' | 'boolean' | 'undefin
const OPTIONAL_BOOLEAN_STRINGS = ['true', 'false', 'undefined'];

const REPORT_NUMBER_PROPERTIES: Array<keyof Report> = [
'lastMessageTimestamp',
'lastReadSequenceNumber',
'managerID',
'lastActorAccountID',
'ownerAccountID',
'total',
'unheldTotal',
'iouReportAmount',
'nonReimbursableTotal',
] satisfies Array<keyof Report>;

Expand All @@ -63,20 +61,16 @@ const REPORT_BOOLEAN_PROPERTIES: Array<keyof Report> = [
'isPinned',
'hasParentAccess',
'isDeletedParentAction',
'openOnAdminRoom',
'isOptimisticReport',
'isWaitingOnBankAccount',
'isCancelledIOU',
'isLastMessageDeletedParentAction',
'isHidden',
'isChatRoom',
'isLoadingPrivateNotes',
'selected',
] satisfies Array<keyof Report>;

const REPORT_DATE_PROPERTIES: Array<keyof Report> = ['lastVisibleActionCreated', 'lastReadCreated', 'lastReadTime', 'lastMentionedTime', 'lastVisibleActionLastModified'] satisfies Array<
keyof Report
>;
const REPORT_DATE_PROPERTIES: Array<keyof Report> = ['lastVisibleActionCreated', 'lastReadTime', 'lastMentionedTime', 'lastVisibleActionLastModified'] satisfies Array<keyof Report>;

const REPORT_REQUIRED_PROPERTIES: Array<keyof Report> = ['reportID'] satisfies Array<keyof Report>;

Expand Down Expand Up @@ -502,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');
}
Expand Down
2 changes: 2 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ type OptionData = {
isConciergeChat?: boolean;
isBold?: boolean;
lastIOUCreationDate?: string;
icons?: Icon[];
iouReportAmount?: number;
} & Report;

type OnyxDataTaskAssigneeChat = {
Expand Down
2 changes: 0 additions & 2 deletions src/types/form/DebugReportForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -94,7 +93,6 @@ type DebugReportForm = Form<
[INPUT_IDS.TOTAL]: string;
[INPUT_IDS.TYPE]: ValueOf<typeof CONST.REPORT.TYPE>;
[INPUT_IDS.UNHELD_TOTAL]: string;
[INPUT_IDS.VISIBLE_CHAT_MEMBER_ACCOUNT_IDS]: string;
[INPUT_IDS.WELCOME_MESSAGE]: string;
[INPUT_IDS.WRITE_CAPABILITY]: ValueOf<typeof CONST.REPORT.WRITE_CAPABILITIES>;
}
Expand Down
21 changes: 0 additions & 21 deletions src/types/onyx/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -98,15 +95,9 @@ 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;

/** The time of the last read of the report */
lastReadCreated?: string;

/** The time when user read the last message */
lastReadTime?: string;

Expand Down Expand Up @@ -161,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;

Expand Down Expand Up @@ -233,15 +221,9 @@ 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;

/** 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;

Expand Down Expand Up @@ -299,9 +281,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback<

/** Participant account id's */
participantAccountIDs?: number[];

/** Visible chat member account id's */
visibleChatMemberAccountIDs?: number[];
},
PolicyReportField['fieldID']
>;
Expand Down
4 changes: 0 additions & 4 deletions tests/utils/collections/optionData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ 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(),
lastReadSequenceNumber: randNumber(),
lastMentionedTime: randBoolean() ? new Date().toISOString() : null,
Expand All @@ -44,10 +42,8 @@ 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}),
currency: randWord(),
isWaitingOnBankAccount: randBoolean(),
lastVisibleActionLastModified: new Date().toISOString(),
Expand Down
1 change: 0 additions & 1 deletion tests/utils/collections/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default function createRandomReport(index: number): Report {
isOptimisticReport: randBoolean(),
isOwnPolicyExpenseChat: randBoolean(),
isWaitingOnBankAccount: randBoolean(),
isLastMessageDeletedParentAction: randBoolean(),
policyID: index.toString(),
reportName: randWord(),
};
Expand Down
Loading