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

fix: Use qualified Ids when matching users for search filtering [WPB-4823] #16138

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

atomrc
Copy link
Contributor

@atomrc atomrc commented Nov 1, 2023

BugWPB-4823 [Web] [Bundestag] Team members not showing up in group search

Description

This attempts to fix an issue where some local users could not be found in the search.
The theory being: since we try to match users by comparing actual user entities (the entire object), if 2 different entities represent the same user, then the check will be false.

const userId = 'user1';
const userA = new User(userId);
const userB = new User(userId);

userA === userB; // false ❌

To fix that, we now match users only by their IDs (which means that 2 entities representing the same user would return true)

const userId = 'user1';
const userA = new User(userId);
const userB = new User(userId);

userA.id === userB.id; // true ✅

Checklist

  • PR has been self reviewed by the author;
  • Hard-to-understand areas of the code have been commented;
  • If it is a core feature, unit tests have been added;

@atomrc atomrc requested review from otto-the-bot and a team as code owners November 1, 2023 14:07
@atomrc atomrc changed the title fix: Use qualified Ids when matching users for search filtering fix: Use qualified Ids when matching users for search filtering [WPB-4823] Nov 1, 2023
Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Merging #16138 (8130e04) into dev (945cb70) will increase coverage by 0.00%.
The diff coverage is 25.00%.

❗ Current head 8130e04 differs from pull request most recent head 0cdb723. Consider uploading reports for the commit 0cdb723 to get more accurate results

@@           Coverage Diff           @@
##              dev   #16138   +/-   ##
=======================================
  Coverage   44.59%   44.59%           
=======================================
  Files         707      707           
  Lines       23133    23132    -1     
  Branches     5259     5260    +1     
=======================================
  Hits        10316    10316           
+ Misses      11474    11473    -1     
  Partials     1343     1343           

@@ -195,6 +195,14 @@ export class ConversationState {
});
}

/**
* indicate whether the selfUser has a conversation with this other user
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, it's actually any kind of conversation (including group conversations). We can have unconnected users there (as opposed to what the connectedUsers suggests 😬 )

@atomrc atomrc merged commit 4d0b1e3 into dev Nov 1, 2023
12 checks passed
@atomrc atomrc deleted the runfix/search-match branch November 1, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants