From 6f27b7ab290218128b4084a33e1f8d5addb8c878 Mon Sep 17 00:00:00 2001 From: Amal Nazeem Date: Wed, 30 Mar 2022 14:51:12 -0400 Subject: [PATCH 1/6] Make case for archived rooms --- src/libs/actions/Report.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 3aaf22887757..d9461c513ff0 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -155,11 +155,20 @@ function getChatReportName(fullReport, chatType) { : '')}`; } - // For a basic policy room or a Policy Expense chat, return its original name - if (ReportUtils.isUserCreatedPolicyRoom({chatType}) || ReportUtils.isPolicyExpenseChat({chatType})) { + // For a basic policy room, return its original name + if (ReportUtils.isUserCreatedPolicyRoom({chatType})) { return LoginUtils.getEmailWithoutMergedAccountPrefix(fullReport.reportName); } + // For a Policy Expense Chat, return its original name and append (archived)' if it is archived + if (ReportUtils.isPolicyExpenseChat({chatType})) { + let name = LoginUtils.getEmailWithoutMergedAccountPrefix(fullReport.reportName); + if (ReportUtils.isArchivedRoom({stateNum: fullReport.state, statusNum: fullReport.status})) { + name += " (archived)"; + } + return name; + } + const {sharedReportList} = fullReport; return _.chain(sharedReportList) .map(participant => participant.email) From 9d7feec184ce48a1fe07b51e211f1e8717dc1a22 Mon Sep 17 00:00:00 2001 From: Amal Nazeem Date: Mon, 4 Apr 2022 18:02:28 -0400 Subject: [PATCH 2/6] Fix comment --- src/libs/actions/Report.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 225b0e2def70..a67c2160eefb 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -160,7 +160,6 @@ function getChatReportName(fullReport, chatType) { return LoginUtils.getEmailWithoutMergedAccountPrefix(fullReport.reportName); } - // For a Policy Expense Chat, return its original name and append (archived)' if it is archived if (ReportUtils.isPolicyExpenseChat({chatType})) { let name = LoginUtils.getEmailWithoutMergedAccountPrefix(fullReport.reportName); if (ReportUtils.isArchivedRoom({stateNum: fullReport.state, statusNum: fullReport.status})) { From 137a0d0f6516b21d97f5beb60a1b44a9aaee2325 Mon Sep 17 00:00:00 2001 From: Amal Nazeem Date: Mon, 4 Apr 2022 18:11:48 -0400 Subject: [PATCH 3/6] Fix string style --- src/libs/actions/Report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index a67c2160eefb..42b114dcf960 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -163,7 +163,7 @@ function getChatReportName(fullReport, chatType) { if (ReportUtils.isPolicyExpenseChat({chatType})) { let name = LoginUtils.getEmailWithoutMergedAccountPrefix(fullReport.reportName); if (ReportUtils.isArchivedRoom({stateNum: fullReport.state, statusNum: fullReport.status})) { - name += " (archived)"; + name += ' (archived)'; } return name; } From ae38cc9acf18d54919e698992ccbed937527f88d Mon Sep 17 00:00:00 2001 From: Amal Nazeem Date: Mon, 4 Apr 2022 22:47:10 -0400 Subject: [PATCH 4/6] Add archived in workspace chat name --- src/languages/en.js | 1 + src/languages/es.js | 1 + src/libs/actions/Report.js | 12 +++++++----- src/libs/reportUtils.js | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/languages/en.js b/src/languages/en.js index 23559fc072c4..b4a507d6d9ea 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -37,6 +37,7 @@ export default { privacyPolicy: 'Privacy policy', delete: 'Delete', deleted: 'deleted', + archived: 'archived', contacts: 'Contacts', recents: 'Recents', close: 'Close', diff --git a/src/languages/es.js b/src/languages/es.js index 62e1f9e0a36c..35ebadde375f 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -37,6 +37,7 @@ export default { privacyPolicy: 'PolĂ­tica de privacidad', delete: 'Eliminar', deleted: 'eliminado', + archived: 'archivado', contacts: 'Contactos', recents: 'Recientes', close: 'Cerrar', diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 1d297e416a1b..0335fe87f035 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -161,11 +161,13 @@ function getChatReportName(fullReport, chatType) { } if (ReportUtils.isPolicyExpenseChat({chatType})) { - let name = LoginUtils.getEmailWithoutMergedAccountPrefix(fullReport.reportName); - if (ReportUtils.isArchivedRoom({stateNum: fullReport.state, statusNum: fullReport.status})) { - name += ' (archived)'; - } - return name; + return `${LoginUtils.getEmailWithoutMergedAccountPrefix(fullReport.reportName)}${(ReportUtils.isArchivedRoom({ + chatType, + stateNum: fullReport.state, + statusNum: fullReport.status, + }) + ? ` (archived)` + : '')}`; } const {sharedReportList} = fullReport; diff --git a/src/libs/reportUtils.js b/src/libs/reportUtils.js index 1eee89cb317c..1b722a71d425 100644 --- a/src/libs/reportUtils.js +++ b/src/libs/reportUtils.js @@ -172,6 +172,7 @@ function isArchivedRoom(report) { if (!isChatRoom(report) && !isPolicyExpenseChat(report)) { return false; } + console.log(report); return report.statusNum === CONST.REPORT.STATUS.CLOSED && report.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED; } From b4c4f6539b8502e7f68ed323517d63c894c652fb Mon Sep 17 00:00:00 2001 From: Amal Nazeem Date: Mon, 4 Apr 2022 22:55:34 -0400 Subject: [PATCH 5/6] correctly use translateLocal --- src/libs/actions/Report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 0335fe87f035..f9fae2da19af 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -166,7 +166,7 @@ function getChatReportName(fullReport, chatType) { stateNum: fullReport.state, statusNum: fullReport.status, }) - ? ` (archived)` + ? ` (${Localize.translateLocal('common.archived')})` : '')}`; } From 4d50d12f8d57d0b5c107d4003a7ae3f989cc525d Mon Sep 17 00:00:00 2001 From: Amal Nazeem Date: Tue, 5 Apr 2022 10:34:11 -0400 Subject: [PATCH 6/6] remove console statement --- src/libs/reportUtils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/reportUtils.js b/src/libs/reportUtils.js index 1b722a71d425..1eee89cb317c 100644 --- a/src/libs/reportUtils.js +++ b/src/libs/reportUtils.js @@ -172,7 +172,6 @@ function isArchivedRoom(report) { if (!isChatRoom(report) && !isPolicyExpenseChat(report)) { return false; } - console.log(report); return report.statusNum === CONST.REPORT.STATUS.CLOSED && report.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED; }