Skip to content

Commit

Permalink
Merge pull request #12953 from Puneet-here/roomNameError
Browse files Browse the repository at this point in the history
display translated error if the room name already exists
  • Loading branch information
iwiznia authored Nov 24, 2022
2 parents 9a22f5b + 1c210b9 commit fd4d662
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pages/ReportSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ class ReportSettingsPage extends Component {
return false;
}

// Show error if the room name already exists
if (ValidationUtils.isExistingRoomName(this.state.newRoomName, this.props.reports, this.props.report.policyID)) {
errors.newRoomName = this.props.translate('newRoomPage.roomAlreadyExistsError');
}

// We error if the user doesn't enter a room name or left blank
if (!this.state.newRoomName || this.state.newRoomName === CONST.POLICY.ROOM_PREFIX) {
errors.newRoomName = this.props.translate('newRoomPage.pleaseEnterRoomName');
Expand Down Expand Up @@ -253,5 +258,8 @@ export default compose(
policies: {
key: ONYXKEYS.COLLECTION.POLICY,
},
reports: {
key: ONYXKEYS.COLLECTION.REPORT,
},
}),
)(ReportSettingsPage);

0 comments on commit fd4d662

Please sign in to comment.