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

Handle archived invoice rooms #48275

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ const CONST = {
ACCOUNT_MERGED: 'accountMerged',
REMOVED_FROM_POLICY: 'removedFromPolicy',
POLICY_DELETED: 'policyDeleted',
INVOICE_RECEIVER_POLICY_DELETED: 'invoiceReceiverPolicyDeleted',
BOOKING_END_DATE_HAS_PASSED: 'bookingEndDateHasPassed',
},
MESSAGE: {
Expand Down
4 changes: 4 additions & 0 deletions src/components/ArchivedReportFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ function ArchivedReportFooter({report, reportClosedAction, personalDetails = {}}

let policyName = ReportUtils.getPolicyName(report);

if (archiveReason === CONST.REPORT.ARCHIVE_REASON.INVOICE_RECEIVER_POLICY_DELETED) {
policyName = originalMessage?.receiverPolicyName ?? '';
}

if (shouldRenderHTML) {
oldDisplayName = lodashEscape(oldDisplayName);
displayName = lodashEscape(displayName);
Expand Down
3 changes: 3 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import type {
RemoveMembersWarningPrompt,
RenamedRoomActionParams,
ReportArchiveReasonsClosedParams,
ReportArchiveReasonsInvoiceReceiverPolicyDeletedParams,
ReportArchiveReasonsMergedParams,
ReportArchiveReasonsPolicyDeletedParams,
ReportArchiveReasonsRemovedFromPolicyParams,
Expand Down Expand Up @@ -640,6 +641,8 @@ export default {
: `This chat is no longer active because ${displayName} is no longer a member of the ${policyName} workspace.`,
[CONST.REPORT.ARCHIVE_REASON.POLICY_DELETED]: ({policyName}: ReportArchiveReasonsPolicyDeletedParams) =>
`This chat is no longer active because ${policyName} is no longer an active workspace.`,
[CONST.REPORT.ARCHIVE_REASON.INVOICE_RECEIVER_POLICY_DELETED]: ({policyName}: ReportArchiveReasonsInvoiceReceiverPolicyDeletedParams) =>
`This chat is no longer active because ${policyName} is no longer an active workspace.`,
[CONST.REPORT.ARCHIVE_REASON.BOOKING_END_DATE_HAS_PASSED]: 'This booking is archived.',
},
writeCapabilityPage: {
Expand Down
3 changes: 3 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import type {
RemoveMembersWarningPrompt,
RenamedRoomActionParams,
ReportArchiveReasonsClosedParams,
ReportArchiveReasonsInvoiceReceiverPolicyDeletedParams,
ReportArchiveReasonsMergedParams,
ReportArchiveReasonsPolicyDeletedParams,
ReportArchiveReasonsRemovedFromPolicyParams,
Expand Down Expand Up @@ -633,6 +634,8 @@ export default {
: `Este chat está desactivado porque ${displayName} ha dejado de ser miembro del espacio de trabajo ${policyName}.`,
[CONST.REPORT.ARCHIVE_REASON.POLICY_DELETED]: ({policyName}: ReportArchiveReasonsPolicyDeletedParams) =>
`Este chat está desactivado porque el espacio de trabajo ${policyName} se ha eliminado.`,
[CONST.REPORT.ARCHIVE_REASON.INVOICE_RECEIVER_POLICY_DELETED]: ({policyName}: ReportArchiveReasonsInvoiceReceiverPolicyDeletedParams) =>
`Este chat está desactivado porque el espacio de trabajo ${policyName} se ha eliminado.`,
[CONST.REPORT.ARCHIVE_REASON.BOOKING_END_DATE_HAS_PASSED]: 'Esta reserva está archivada.',
},
writeCapabilityPage: {
Expand Down
5 changes: 5 additions & 0 deletions src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ type ReportArchiveReasonsPolicyDeletedParams = {
policyName: string;
};

type ReportArchiveReasonsInvoiceReceiverPolicyDeletedParams = {
policyName: string;
};

type RequestCountParams = {
count: number;
scanningReceipts: number;
Expand Down Expand Up @@ -425,6 +429,7 @@ export type {
ReportArchiveReasonsClosedParams,
ReportArchiveReasonsMergedParams,
ReportArchiveReasonsPolicyDeletedParams,
ReportArchiveReasonsInvoiceReceiverPolicyDeletedParams,
ReportArchiveReasonsRemovedFromPolicyParams,
RequestAmountParams,
RequestCountParams,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6135,7 +6135,7 @@ function getChatByParticipants(newParticipantList: number[], reports: OnyxCollec
*/
function getInvoiceChatByParticipants(policyID: string, receiverID: string | number, reports: OnyxCollection<Report> = ReportConnection.getAllReports()): OnyxEntry<Report> {
return Object.values(reports ?? {}).find((report) => {
if (!report || !isInvoiceRoom(report)) {
if (!report || !isInvoiceRoom(report) || isArchivedRoom(report)) {
return false;
}

Expand Down
3 changes: 3 additions & 0 deletions src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ type OriginalMessageClosed = {

/** If the report was closed because accounts got merged, then this is the old account ID */
oldAccountID?: number;

/** Name of the invoice receiver's policy */
receiverPolicyName?: string;
};

/** Model of `renamed` report action, created when chat rooms get renamed */
Expand Down
Loading