Skip to content

Commit

Permalink
Merge pull request #7340 from Expensify/puneet-block-concierge
Browse files Browse the repository at this point in the history
Don't allow users to chat with Concierge when blocked
  • Loading branch information
chiragsalian authored Jan 22, 2022
2 parents 60953b2 + 5ea46c1 commit d596d0b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -1181,6 +1182,18 @@ function addAction(reportID, text, file) {
console.error(response.message);
return;
}

if (response.jsonCode === 666 && reportID === conciergeChatReportID) {
Growl.error(Localize.translateLocal('reportActionCompose.blockedFromConcierge'));
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
[optimisticReportActionID]: null,
});

// 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;
}

updateReportWithNewAction(reportID, response.reportAction);
});
}
Expand Down
1 change: 1 addition & 0 deletions src/libs/actions/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ class ReportActionCompose extends React.Component {
{shouldShowReportRecipientLocalTime
&& <ParticipantLocalTime participant={reportRecipient} />}
<View style={[
(this.state.isFocused || this.state.isDraggingOver)
(!isBlockedFromConcierge && (this.state.isFocused || this.state.isDraggingOver))
? styles.chatItemComposeBoxFocusedColor
: styles.chatItemComposeBoxColor,
styles.chatItemComposeBox,
Expand Down

0 comments on commit d596d0b

Please sign in to comment.