topcoder-platform / community-app

React webapp for serving Topcoder Community
125 stars 214 forks source link

Saving a profile that doesn't have a country set #6890

Closed jmgasper closed 1 year ago

jmgasper commented 1 year ago

REF: https://topcoder.atlassian.net/browse/PROD-4287

Bug

Few users reported that they are not able to update the profile data and facing below error.

image-20230605-165605

Cause

Apparently, there are user accounts in the member API that do not have a homeCountryCode or competitionCountryCode set.

Fix

When loading a profile to edit, we must handle the case where there's no country set on an account for the Country field. The user must be forced to pick a country before they can save an updated profile.

This is working, but the country field is only being used to set the country in the basic_info trait.

If the user has update the country, we need to set homeCountryCode or competitionCountryCode when sending the PUT to https://api.topcoder-dev.com/v5/members/{handle} as well. There should be existing code in Community App to map from a country name to the country code.

SCR-20230614-mgnw

Test

User jgasperMobile12 has no country set. Let me know if you need it removed again for testing.