From 7842a81193f0447d781b4ec45d305f1caf4ffc1b Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Thu, 20 Jan 2022 15:45:18 -0500 Subject: [PATCH 1/4] Add private_blockedFromConcierge to the list of NVPs that is returned for user --- src/libs/actions/User.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/User.js b/src/libs/actions/User.js index 455812491ee2..b3ec5411b526 100644 --- a/src/libs/actions/User.js +++ b/src/libs/actions/User.js @@ -103,6 +103,7 @@ function getUserDetails() { CONST.NVP.PAYPAL_ME_ADDRESS, CONST.NVP.PREFERRED_EMOJI_SKIN_TONE, CONST.NVP.FREQUENTLY_USED_EMOJIS, + CONST.NVP.BLOCKED_FROM_CONCIERGE, ].join(','), }) .then((response) => { From 0bb7c8d72cdc42ccae1127156f754d3c56d22a34 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Thu, 20 Jan 2022 16:16:43 -0500 Subject: [PATCH 2/4] Handle the API response when we attepmt to chat with concierge while blocked --- src/libs/actions/Report.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 6555425f3e50..9f94d22436e2 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -10,6 +10,7 @@ import * as Pusher from '../Pusher/pusher'; import LocalNotification from '../Notification/LocalNotification'; import PushNotification from '../Notification/PushNotification'; import * as PersonalDetails from './PersonalDetails'; +import * as User from './User'; import Navigation from '../Navigation/Navigation'; import * as ActiveClientManager from '../ActiveClientManager'; import Visibility from '../Visibility'; @@ -1181,6 +1182,18 @@ function addAction(reportID, text, file) { console.error(response.message); return; } + + if (response.jsonCode === 666 && reportID === conciergeChatReportID) { + Growl.error('You are blocked from chatting with Concierge.'); + Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, { + [optimisticReportActionID]: null, + }); + + // The fact that we're getting this error from the API means the BLOCKED_FROM_CONCIERGE nvp in the user details has changed since the last time we checked, so let's trigger an update + User.getUserDetails(); + return; + } + updateReportWithNewAction(reportID, response.reportAction); }); } From 3b0f231d46250f760720322f08a3ce3f7de2e923 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Thu, 20 Jan 2022 16:19:45 -0500 Subject: [PATCH 3/4] Translate growl error when concierge communication is barred --- 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 9f94d22436e2..017fc95e32bf 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1184,7 +1184,7 @@ function addAction(reportID, text, file) { } if (response.jsonCode === 666 && reportID === conciergeChatReportID) { - Growl.error('You are blocked from chatting with Concierge.'); + Growl.error(Localize.translateLocal('reportActionCompose.blockedFromConcierge')); Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, { [optimisticReportActionID]: null, }); From 5ea46c113b4d43b1dc2867cb31752c46601ae010 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Thu, 20 Jan 2022 17:02:53 -0500 Subject: [PATCH 4/4] Dont show the compose box as selected if user is blocked from chatting --- src/libs/actions/Report.js | 2 +- src/pages/home/report/ReportActionCompose.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 017fc95e32bf..971e91f078c4 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1189,7 +1189,7 @@ function addAction(reportID, text, file) { [optimisticReportActionID]: null, }); - // The fact that we're getting this error from the API means the BLOCKED_FROM_CONCIERGE nvp in the user details has changed since the last time we checked, so let's trigger an update + // The fact that the API is returning this error means the BLOCKED_FROM_CONCIERGE nvp in the user details has changed since the last time we checked, so let's update User.getUserDetails(); return; } diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 51759e6bb846..d28b7b75d0fc 100755 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -505,7 +505,7 @@ class ReportActionCompose extends React.Component { {shouldShowReportRecipientLocalTime && }