Skip to content

User filter for community links#42

Merged
bastien-phi merged 5 commits intomainfrom
user_filter_for_community_links
Jul 8, 2025
Merged

User filter for community links#42
bastien-phi merged 5 commits intomainfrom
user_filter_for_community_links

Conversation

@bastien-phi
Copy link
Copy Markdown
Owner

This pull request introduces enhancements to the community links feature, focusing on filtering by user, improving the user interface, and adding new functionality for fetching community users. The most significant changes include updates to support user-based filtering, modifications to UI components for better accessibility and styling, and the addition of a new controller and action for fetching community users.

Backend Changes

User-based filtering for community links:

  • Added filterUser method in app/Actions/GetCommunityLinks.php to filter links by user UUID.
  • Updated GetCommunityLinksRequest to include a user parameter and validation rules for UUID format. [1] [2]

New community users feature:

  • Created GetCommunityUsers action to fetch users associated with public and published links.
  • Added CommunityUserController to handle fetching community users via an API endpoint.

Frontend Changes

User search and filtering:

  • Updated resources/js/pages/community-links/index.tsx to support user selection and search functionality, including fetching users via the new API endpoint. [1] [2]

UI improvements:

  • Enhanced dropdown styling across multiple components (autocomplete.tsx, multi-suggest.tsx, remote-autocomplete.tsx, suggest.tsx) for better accessibility and dark mode support. [1] [2] [3] [4]
  • Updated pill.tsx to improve hover and focus states for the close button.

These changes collectively improve the functionality and user experience of the community links feature, enabling more precise filtering and enhancing the UI for better usability.

@bastien-phi bastien-phi requested a review from Copilot July 8, 2025 14:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds user-based filtering to community links, introduces an endpoint and action for fetching community users, and updates the frontend UI to support selecting and filtering by user, along with dark-mode and accessibility improvements.

  • Backend:
    • Extend GetCommunityLinks to filter by user UUID and validate the new user request parameter.
    • Add GetCommunityUsers action and CommunityUserController to fetch users with public links.
  • Frontend:
    • Enhance the community links page to include a user filter with autocomplete.
    • Update multiple UI components (suggest, autocomplete, pill, etc.) for dark mode and styling consistency.
  • Tests & Routes:
    • Update unit and feature tests to cover user filtering and the new API.
    • Register a new /api/users route for community users.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/Unit/Actions/GetCommunityUsersTest.php Adds unit tests for fetching community users
tests/Unit/Actions/GetCommunityLinksTest.php Updates unit tests to include and test user-based filtering
tests/Feature/CommunityUserControllerTest.php Adds feature tests for CommunityUserController
tests/Feature/CommunityLinkControllerTest.php Updates feature tests to assert user support in links API
routes/api.php Registers community-users.index API route
app/Actions/GetCommunityUsers.php New action to fetch community users
app/Http/Controllers/CommunityUserController.php New controller for community users endpoint
app/Actions/GetCommunityLinks.php Extends link-fetching action with filterUser
app/Data/Requests/GetCommunityLinksRequest.php Adds user parameter and validation
app/Http/Controllers/CommunityLinkController.php Passes selected user to Inertia view
resources/js/pages/community-links/index.tsx Implements user filter UI, state, and routing
resources/js/components/ui/suggest.tsx Improves dark-mode dropdown styling
resources/js/components/ui/remote-multi-autocomplete.tsx Updates onValueAdded typing
resources/js/components/ui/remote-autocomplete.tsx Updates onValueChanged typing and dropdown styling
resources/js/components/ui/pill.tsx Refines pill close button styling
resources/js/components/ui/multi-suggest.tsx Refines dropdown styling for multi-suggest
resources/js/components/ui/autocomplete.tsx Refines dropdown styling for autocomplete
resources/js/components/community-link-card.tsx Adds user link for filtering in card header
Comments suppressed due to low confidence (3)

resources/js/pages/community-links/index.tsx:55

  • Since you’re now also filtering by user, consider updating the only array to ['links', 'user'] so Inertia will only reload the relevant props and avoid unnecessary rerenders.
        router.get(route('community-links.index'), clearFormData(data), {

app/Http/Controllers/CommunityUserController.php:14

  • The parameter $getCommunityAuthors is misnamed since it’s an instance of GetCommunityUsers. Rename it to $getCommunityUsers for clarity and consistency.
    public function index(SearchRequest $data, GetCommunityUsers $getCommunityAuthors): JsonResource

app/Actions/GetCommunityLinks.php:90

  • The closure’s parameter $user (UUID) is shadowed by this local $user variable (a model). Consider renaming the constructor argument to $userUuid and this variable to $user or $foundUser to avoid confusion.
        $user = User::query()->where('uuid', $user)->first();

@bastien-phi bastien-phi merged commit ee62a65 into main Jul 8, 2025
6 checks passed
@bastien-phi bastien-phi deleted the user_filter_for_community_links branch July 8, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants