Skip to content

Commit 31056f0

Browse files
committed
Rename var
1 parent 303a0a6 commit 31056f0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libraries/usersearch/impl/src/main/kotlin/io/element/android/libraries/usersearch/impl/MatrixUserRepository.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class MatrixUserRepository @Inject constructor(
3737
) : UserRepository {
3838

3939
override suspend fun search(query: String): Flow<List<UserSearchResult>> = flow {
40-
// Manually add a fake result with the matrixId, if provided and not the local user
41-
val isAnotherUsersId = MatrixPatterns.isUserId(query) && !client.isMe(UserId(query))
42-
if (isAnotherUsersId) {
40+
// If the search term is a MXID that's not ours, we'll show a 'fake' result for that user, then update it when we get search results.
41+
val shouldQueryProfile = MatrixPatterns.isUserId(query) && !client.isMe(UserId(query))
42+
if (shouldQueryProfile) {
4343
emit(listOf(UserSearchResult(MatrixUser(UserId(query)))))
4444
}
4545

@@ -54,7 +54,7 @@ class MatrixUserRepository @Inject constructor(
5454
.toMutableList()
5555

5656
// If the query is another user's MXID and the result doesn't contain that user ID, query the profile information explicitly
57-
if (isAnotherUsersId && results.none { it.matrixUser.userId.value == query }) {
57+
if (shouldQueryProfile && results.none { it.matrixUser.userId.value == query }) {
5858
results.add(
5959
0,
6060
dataSource.getProfile(UserId(query))

0 commit comments

Comments
 (0)