fix: trim team channel search filter before listing channels

PR
2mo ago
+77-15

Proposed changes

This PR normalizes the Team Channels search filter by trimming leading and trailing whitespace before it is used to retrieve matching channels.

Previously, searches containing leading or trailing whitespace (for example, general or general) returned no results even though the trimmed search term matched correctly.

The search filter is now normalized before listing team channels, providing consistent search behavior while preserving the existing behavior for empty searches.

Issue(s)

Closes #41697

Steps to test or reproduce

  1. Open any team.
  2. Open the Team Channels panel.
  3. Search for an existing channel (for example, general) and verify that it is returned.
  4. Search again using:
    • general
    • general
    • general
  5. Verify the same matching channel is returned.
  6. Verify that an empty search and a search containing only whitespace continue to display all available team channels.

Further comments

The search filter is trimmed before it is passed to the room lookup logic, ensuring that leading and trailing whitespace does not affect search results while preserving the existing behavior.

Summary by CodeRabbit

  • Bug Fixes
    • Improved search behavior by ignoring leading and trailing spaces in user, room, and subscription searches.
    • Prevented empty or whitespace-only searches from applying unnecessary filters.
    • Preserved case-insensitive matching across supported search fields.
    • Improved handling of optional mention prefixes in navigation search.