-
Notifications
You must be signed in to change notification settings - Fork 36
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
Conversation
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.
Codecov ReportAttention: Patch coverage is
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. |
- 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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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 functionfilterHiddenProfiles
to exclude profiles with hidden indicators in theirdisplayName
,bio
, orid
properties.Integration of the New Utility Function:
src/components/login-modal/profile-select-view.tsx
: Updated the profile selection logic to usefilterHiddenProfiles
when setting profiles.src/layouts/_common/searchbar/searchbar.tsx
: AppliedfilterHiddenProfiles
to the search results to filter out hidden profiles.src/sections/explore/view.tsx
: UsedfilterHiddenProfiles
to clean up hidden profiles in the explore view.src/sections/finance/index.tsx
: IntegratedfilterHiddenProfiles
to filter out hidden profiles from the following list.src/sections/user/view/user-profile-view.tsx
: AppliedfilterHiddenProfiles
to followers and following lists in the user profile view.