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

refactor: filter testing profiles. #543

Merged
merged 16 commits into from
Feb 14, 2025
Merged

Conversation

cswni
Copy link
Contributor

@cswni cswni commented Feb 14, 2025

This pull request includes significant updates to the codebase, primarily focusing on the introduction of a new utility function to filter hidden profiles and various improvements to workflows and documentation.

Utility Function for Filtering Hidden Profiles:

  • src/utils/profile.ts: Added a new function filterHiddenProfiles to exclude profiles with hidden indicators in their displayName, bio, or id properties.

Integration of the New Utility Function:

geolffreym and others added 14 commits February 7, 2025 10:09
Ensure hidden profiles are excluded when fetching and displaying user profiles in the profile selection view.

- `profile-select-view.tsx`: Imported `filterHiddenProfiles` utility and applied it to filter out hidden profiles from the results in `setProfiles` method.
- Updated `src/sections/explore/view.tsx`:
  - Integrated `filterHiddenProfiles` utility to exclude hidden profiles.
  - Refactored existing logic to streamline filtering of profiles with valid `displayName` and `bio`.

This improvement ensures better data quality and eliminates unwanted hidden profiles from exploration results.
Introduced `filterHiddenProfiles` to filter out profiles containing specific hidden indicators (`###HIDDEN###`) in their `displayName`, `bio`, or `id` fields.

- src/utils/profile.ts:
  - Added `filterHiddenProfiles` function.
  - Imported `Profile` type from `@lens-protocol/api-bindings`.
- Updated `user-profile-view.tsx` to apply `filterHiddenProfiles` utility.
- Ensured followers and following lists exclude hidden profiles before dispatching to the store.
- Updated `searchbar.tsx` to include `filterHiddenProfiles` function from `profile.ts`.
- Renamed variable `profiles` to `results` for clarity in search results.
- Applied `filterHiddenProfiles` to exclude hidden profiles from displayed results.
- Updated `src/sections/finance/index.tsx` to filter hidden profiles using `filterHiddenProfiles` utility function.
- Renamed the `following` variable to `results` for clarity before applying the filtering logic.
- This ensures unwanted profiles are excluded from the UI display.
- Updated `filterHiddenProfiles` to handle `null`/`undefined` inputs, returning the same as output.
- Refined logic to check hidden indicators in `displayName`, `bio`, and `id` fields.
- Cleaned up and removed outdated comments and unused code for better readability.
@cswni cswni added the Refactor label Feb 14, 2025
@cswni cswni requested review from geolffreym and Jadapema February 14, 2025 18:30
@cswni cswni self-assigned this Feb 14, 2025
@cswni cswni linked an issue Feb 14, 2025 that may be closed by this pull request
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 0.13%. Comparing base (537b029) to head (8d1d7b0).
Report is 31 commits behind head on next.

Files with missing lines Patch % Lines
src/layouts/_common/searchbar/searchbar.tsx 0.00% 3 Missing ⚠️
src/sections/user/view/user-profile-view.tsx 0.00% 3 Missing ⚠️
src/sections/explore/view.tsx 0.00% 2 Missing ⚠️
src/sections/finance/index.tsx 0.00% 2 Missing ⚠️
src/components/login-modal/profile-select-view.tsx 0.00% 1 Missing ⚠️
...ections/finance/components/finance-earn-tokens.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            next    #543      +/-   ##
========================================
+ Coverage   0.03%   0.13%   +0.10%     
========================================
  Files        557     557              
  Lines      30734   30743       +9     
  Branches     557     569      +12     
========================================
+ Hits          11      43      +32     
+ Misses     30167   30145      -22     
+ Partials     556     555       -1     

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

- Updated the import path for ProfileData in `src/utils/profile.ts` to reflect the new location under `web3Auth` types.
- This ensures the code aligns with the updated directory structure and resolves any potential import issues.
- Add test cases for `buildProfileMetadata` in `profile.test.tsx`:
  - Ensure social links are cleaned and included in metadata.
  - Verify empty values are removed from the metadata object.
- Add test cases for `filterHiddenProfiles` in `profile.test.tsx`:
  - Test filtering of profiles with hidden indicators.
  - Check handling of `undefined` input and fully filtered arrays.
This improves test coverage for profile-related utilities.
Copy link

Copy link
Member

@Jadapema Jadapema left a comment

Choose a reason for hiding this comment

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

LGTM

@Jadapema Jadapema merged commit 58408c9 into next Feb 14, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

refactor: clear test accounts from lens
3 participants