Skip to content
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
2 changes: 1 addition & 1 deletion src/components/TeamManagement/TeamManagement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class TeamManagement extends React.Component {
const topcoderTeamViewAction = !topcoderTeamManageAction
const canJoinAsCopilot = !currentMember && currentUser.isCopilot
const canJoinAsManager = !currentMember && (currentUser.isManager || currentUser.isAccountManager)
const canShowInvite = currentMember && (currentUser.isCustomer || currentMember.isCopilot || currentMember.isManager)
const canShowInvite = currentMember && (currentMember.isCustomer || currentMember.isCopilot || currentMember.isManager)

const sortedMembers = members
let projectTeamInviteCount = 0
Expand Down
10 changes: 10 additions & 0 deletions src/routes/settings/helpers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Setting related helper methods
*/
import _ from 'lodash'
import ISOCountries from '../../../helpers/ISOCountries'

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

// Convert home country code from 3 digit numeric string to 3 letter alphabetical code.
// Numeric code is not supported by member service.
let homeCountryCode = _.get(trait, 'traits.data[0].homeCountryCode')
if (homeCountryCode && /^\d{3}$/.test(homeCountryCode)) {
const homeCountryISO = _.find(ISOCountries, c => c.numericString === homeCountryCode)
homeCountryCode = homeCountryISO && homeCountryISO.alpha3
}

// update only if new values are defined
const updatedProps = _.omitBy({
photoURL,
firstName,
lastName,
country,
homeCountryCode,
}, _.isUndefined)

updatedTrait.traits = {
Expand Down