mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Rename UserProfileProxy to UserProfile. It's a pure struct and proxies nothing.
Also remove the redundant `userID` property given `id` already exists (for Identifiable conformance).
This commit is contained in:
@@ -15,7 +15,7 @@ final class UserDiscoveryService: UserDiscoveryServiceProtocol {
|
||||
self.clientProxy = clientProxy
|
||||
}
|
||||
|
||||
func searchProfiles(with searchQuery: String) async -> Result<[UserProfileProxy], UserDiscoveryErrorType> {
|
||||
func searchProfiles(with searchQuery: String) async -> Result<[UserProfile], UserDiscoveryErrorType> {
|
||||
async let queriedProfile = profileIfPossible(with: searchQuery)
|
||||
|
||||
do {
|
||||
@@ -32,7 +32,7 @@ final class UserDiscoveryService: UserDiscoveryServiceProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
private func merge(queriedProfile: UserProfileProxy?, searchResults: SearchUsersResultsProxy) -> [UserProfileProxy] {
|
||||
private func merge(queriedProfile: UserProfile?, searchResults: SearchUsersResultsProxy) -> [UserProfile] {
|
||||
let searchResults = searchResults.results
|
||||
|
||||
guard let queriedProfile else {
|
||||
@@ -40,13 +40,13 @@ final class UserDiscoveryService: UserDiscoveryServiceProtocol {
|
||||
}
|
||||
|
||||
let filteredSearchResult = searchResults.filter {
|
||||
$0.userID != queriedProfile.userID
|
||||
$0.id != queriedProfile.id
|
||||
}
|
||||
|
||||
return [queriedProfile] + filteredSearchResult
|
||||
}
|
||||
|
||||
private func profileIfPossible(with searchQuery: String) async -> UserProfileProxy? {
|
||||
private func profileIfPossible(with searchQuery: String) async -> UserProfile? {
|
||||
guard searchQuery.isMatrixIdentifier, searchQuery != clientProxy.userID else {
|
||||
return nil
|
||||
}
|
||||
@@ -57,9 +57,9 @@ final class UserDiscoveryService: UserDiscoveryServiceProtocol {
|
||||
return getProfileResult ?? .init(userID: searchQuery)
|
||||
}
|
||||
|
||||
private func filterAccountOwner(_ profiles: [UserProfileProxy]) -> [UserProfileProxy] {
|
||||
private func filterAccountOwner(_ profiles: [UserProfile]) -> [UserProfile] {
|
||||
let accountOwnerID = clientProxy.userID
|
||||
return profiles.filter { $0.userID != accountOwnerID }
|
||||
return profiles.filter { $0.id != accountOwnerID }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user