fix: own account showing twice in navbar room search when searching by username

Merged
NA
4mo ago
+65-2

Proposed changes (including videos or screenshots)

Filter out own DMs from local rooms. Previously we were only removing duplicate of DMs with only two members (room.uids.length === 2 condition in sameDirectDM).

Issue(s)

SUP-1069 Own account shows twice in navbar user search when searching by username (self DM duplicate)

Steps to test or reproduce

  1. Log in as any user.
  2. Create a DM with yourself.
  3. Open the navbar search.
  4. Search for your own username (not display name).
  5. Your account is listed twice in the dropdown.
  6. Open either entry: both open the same direct message with yourself.

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Fixed navbar room search so your own account no longer appears twice when searching by username.
    • Improved navbar search result merging by better deduplicating direct-message results representing the same DM user.
  • Tests

    • Added Jest coverage for the navbar search hook to verify both deduped (duplicate DM user) and appended (non-duplicate) results.