Skip to content

Commit

Permalink
Merge pull request #52963 from callstack-internal/chore/remove-isHidd…
Browse files Browse the repository at this point in the history
…en-property-from-report

remove isHidden property from report
  • Loading branch information
puneetlath authored Nov 26, 2024
2 parents 2ce0764 + 6a9a769 commit 3f4e93e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/libs/DebugUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ function validateReportDraftProperty(key: keyof Report, value: string) {
case 'isOptimisticReport':
case 'isWaitingOnBankAccount':
case 'isCancelledIOU':
case 'isHidden':
return validateBoolean(value);
case 'lastReadSequenceNumber':
case 'managerID':
Expand Down Expand Up @@ -621,7 +620,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,
Expand Down
4 changes: 0 additions & 4 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ type OptimisticChatReport = Pick<
| 'writeCapability'
| 'avatarUrl'
| 'invoiceReceiver'
| 'isHidden'
> & {
isOptimisticReport: true;
};
Expand Down Expand Up @@ -6518,8 +6517,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.
Expand Down Expand Up @@ -7400,7 +7397,6 @@ function getTaskAssigneeChatOnyxData(
pendingFields: {
createChat: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
isHidden: false,
},
},
{
Expand Down
18 changes: 12 additions & 6 deletions src/libs/actions/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
3 changes: 0 additions & 3 deletions src/types/onyx/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<number, Note>;

Expand Down
1 change: 0 additions & 1 deletion src/types/utils/whitelistedReportKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ type WhitelistedReport = OnyxCommon.OnyxValueWithOfflineFeedback<
iouReportID: unknown;
preexistingReportID: unknown;
nonReimbursableTotal: unknown;
isHidden: unknown;
privateNotes: unknown;
pendingChatMembers: unknown;
fieldList: unknown;
Expand Down

0 comments on commit 3f4e93e

Please sign in to comment.