Fix bug when determining contact status

Users are sorted by login but we were binary-searching them by id.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-05-10 17:26:53 +02:00
parent d4e6ab4975
commit 93688cbe22

View File

@ -283,19 +283,19 @@ impl UserStore {
ContactRequestStatus::Pending
} else if self
.contacts
.binary_search_by_key(&&user.id, |contact| &contact.user.id)
.binary_search_by_key(&&user.github_login, |contact| &contact.user.github_login)
.is_ok()
{
ContactRequestStatus::RequestAccepted
} else if self
.outgoing_contact_requests
.binary_search_by_key(&&user.id, |user| &user.id)
.binary_search_by_key(&&user.github_login, |user| &user.github_login)
.is_ok()
{
ContactRequestStatus::RequestSent
} else if self
.incoming_contact_requests
.binary_search_by_key(&&user.id, |user| &user.id)
.binary_search_by_key(&&user.github_login, |user| &user.github_login)
.is_ok()
{
ContactRequestStatus::RequestReceived