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

Don't allow users to chat with Concierge when blocked #7340

Merged
merged 4 commits into from
Jan 22, 2022
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
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