Skip to content

Commit

Permalink
add: originalFileName to report onyx
Browse files Browse the repository at this point in the history
  • Loading branch information
nexarvo committed Jun 12, 2024
1 parent 6d6953f commit 9d4a66f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ function updateGroupChatAvatar(reportID: string, file?: File | CustomRNImageMani
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
avatarUrl: file?.uri ?? '',
originalFileName: file?.name ?? '',
pendingFields: {
avatar: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},
Expand All @@ -689,6 +690,7 @@ function updateGroupChatAvatar(reportID: string, file?: File | CustomRNImageMani
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
avatarUrl: currentReportData?.[reportID]?.avatarUrl ?? null,
originalFileName: currentReportData?.[reportID]?.originalFileName ?? null,
pendingFields: {
avatar: null,
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ReportAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function ReportAvatar({report = {} as Report, policies, isLoadingApp = true, rou
} else {
avatarURL = policy ? ReportUtils.getWorkspaceAvatar(report) : report?.avatarUrl;
// In the case of default workspace avatar, originalFileName prop takes policyID as value to get the color of the avatar
fileName = policy?.originalFileName ?? policy?.id ?? report?.policyID;
fileName = policy ? policy?.originalFileName ?? policy?.id ?? report?.policyID : report?.originalFileName;
title = policy ? ReportUtils.getPolicyName(report, false, policy) : ReportUtils.getReportName(report);
shouldShowNotFoundPage = !isLoadingApp && !report?.reportID;
}
Expand Down
3 changes: 3 additions & 0 deletions src/types/onyx/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback<
/** The URL of the Group Chat report custom avatar */
avatarUrl?: string;

/** The file name of the Group Chat report custom avatar */
originalFileName?: string;

/** The specific type of chat */
chatType?: ValueOf<typeof CONST.REPORT.CHAT_TYPE>;

Expand Down

0 comments on commit 9d4a66f

Please sign in to comment.