Skip to content

Commit

Permalink
fix: add fully qualified handle for external results (WPB-6256) (#2676)
Browse files Browse the repository at this point in the history
  • Loading branch information
yamilmedina authored and github-actions[bot] committed Feb 8, 2024
1 parent 8f8a6e1 commit e7be962
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/src/main/kotlin/com/wire/android/mapper/ContactMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import com.wire.kalium.logic.data.publicuser.model.UserSearchDetails
import com.wire.kalium.logic.data.service.ServiceDetails
import com.wire.kalium.logic.data.user.ConnectionState
import com.wire.kalium.logic.data.user.OtherUser
import com.wire.kalium.logic.data.user.type.UserType
import javax.inject.Inject

class ContactMapper
Expand Down Expand Up @@ -76,7 +77,7 @@ class ContactMapper
id = id.value,
domain = id.domain,
name = name ?: String.EMPTY,
label = handle ?: String.EMPTY,
label = mapUserHandle(user),

Check warning on line 80 in app/src/main/kotlin/com/wire/android/mapper/ContactMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/mapper/ContactMapper.kt#L80

Added line #L80 was not covered by tests
avatarData = UserAvatarData(
asset = previewAssetId?.let { ImageAsset.UserAvatarAsset(wireSessionImageLoader, it) }
),
Expand All @@ -85,4 +86,14 @@ class ContactMapper
)
}
}

/**
* Adds the fully qualified handle to the contact label in case of federated users.
*/
private fun mapUserHandle(user: UserSearchDetails): String {
return when (user.type) {

Check warning on line 94 in app/src/main/kotlin/com/wire/android/mapper/ContactMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/mapper/ContactMapper.kt#L94

Added line #L94 was not covered by tests
UserType.FEDERATED -> "${user.handle}@${user.id.domain}"
else -> user.handle ?: String.EMPTY
}
}
}

0 comments on commit e7be962

Please sign in to comment.