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

feat: added country disabling feature #1084

Merged
merged 4 commits into from
Sep 17, 2024
Merged

Conversation

awais-ansari
Copy link
Contributor

INF-1567

Description

  • Countries in the disabledCountries list will no longer be visible to users in the profile settings of other countries, and users will not be able to switch to disabled countries.
  • User with a disabled country selected can change their country to another one. After switching, they cannot select the disabled country again.
  • Implemented frontend validation to verify the country against the disabled countries list to prevent invalid country submissions.

For Example, if Russia is on the disabled countries list.

Other Country Users will not see Russia in the country list as an

Screenshot 2024-09-14 at 2 43 09 PM Screenshot 2024-09-14 at 2 43 20 PM

Russian user will see Russia in the country list but it'll be disabled and they can change their country to another one.

Screenshot 2024-09-14 at 2 44 11 PM Screenshot 2024-09-14 at 2 45 54 PM

Note

  • The disabledCountries list will be fetched from an API in phase 2 implementation.

Copy link

codecov bot commented Sep 14, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.

Project coverage is 67.12%. Comparing base (b13fc58) to head (28c8daa).
Report is 1 commits behind head on 2u-main.

Files with missing lines Patch % Lines
src/profile/forms/Country.jsx 81.25% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           2u-main    #1084      +/-   ##
===========================================
+ Coverage    66.78%   67.12%   +0.34%     
===========================================
  Files           51       51              
  Lines          849      864      +15     
  Branches       173      176       +3     
===========================================
+ Hits           567      580      +13     
- Misses         272      274       +2     
  Partials        10       10              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/profile/ProfilePage.test.jsx Show resolved Hide resolved
expect(tree).toMatchSnapshot();
});

it('test user with disabled country', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use it.each since most of the code is the same, and we are only checking whether the country is disabled or not.

@awais-ansari awais-ansari merged commit 87d6a0f into 2u-main Sep 17, 2024
11 checks passed
@awais-ansari awais-ansari deleted the aansari/INF-1567 branch September 17, 2024 12:54
awais-ansari added a commit that referenced this pull request Oct 1, 2024
* feat: added country disabling feature

* fix: lint errors

* test: added test case for disabled countries

* refactor: combined test cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants