Skip to content

Commit ec920c1

Browse files
authored
Merge pull request #3445 from appirio-tech/hotfix/fix-countryCode-error-for-numericCode
[HOTIFX] [PROD] fix country code error for numeric code
2 parents 98e25cf + af18b2c commit ec920c1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/components/TeamManagement/TeamManagement.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class TeamManagement extends React.Component {
100100
const topcoderTeamViewAction = !topcoderTeamManageAction
101101
const canJoinAsCopilot = !currentMember && currentUser.isCopilot
102102
const canJoinAsManager = !currentMember && (currentUser.isManager || currentUser.isAccountManager)
103-
const canShowInvite = currentMember && (currentUser.isCustomer || currentMember.isCopilot || currentMember.isManager)
103+
const canShowInvite = currentMember && (currentMember.isCustomer || currentMember.isCopilot || currentMember.isManager)
104104

105105
const sortedMembers = members
106106
let projectTeamInviteCount = 0

src/routes/settings/helpers/settings.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Setting related helper methods
33
*/
44
import _ from 'lodash'
5+
import ISOCountries from '../../../helpers/ISOCountries'
56

67
// blank traits object which we can use if trait doesn't exist to create a new one
78
export const blankTraits = {
@@ -118,12 +119,21 @@ export const applyProfileSettingsToTraits = (traits, profileSettings) => {
118119
// define country similar to connect_info if not present for basic_info
119120
const country = _.get(trait, 'traits.data[0].country', profileSettings.country)
120121

122+
// Convert home country code from 3 digit numeric string to 3 letter alphabetical code.
123+
// Numeric code is not supported by member service.
124+
let homeCountryCode = _.get(trait, 'traits.data[0].homeCountryCode')
125+
if (homeCountryCode && /^\d{3}$/.test(homeCountryCode)) {
126+
const homeCountryISO = _.find(ISOCountries, c => c.numericString === homeCountryCode)
127+
homeCountryCode = homeCountryISO && homeCountryISO.alpha3
128+
}
129+
121130
// update only if new values are defined
122131
const updatedProps = _.omitBy({
123132
photoURL,
124133
firstName,
125134
lastName,
126135
country,
136+
homeCountryCode,
127137
}, _.isUndefined)
128138

129139
updatedTrait.traits = {

0 commit comments

Comments
 (0)