Do not display " (IRC)") in display names

This commit is contained in:
Benoit Marty 2019-12-14 10:19:11 +01:00
parent fbb1846694
commit 3e4b07cec3
2 changed files with 6 additions and 3 deletions

View file

@ -13,6 +13,7 @@ Other changes:
Bugfix 🐛:
- Scroll breadcrumbs to top when opened
- Render default room name when it starts with an emoji (#477)
- Do not display " (IRC)") in display names https://github.com/vector-im/riot-android/issues/444
Translations 🗣:
-

View file

@ -29,8 +29,8 @@ sealed class MatrixItem(
) {
data class UserItem(override val id: String,
override val displayName: String? = null,
override val avatarUrl: String? = null
) : MatrixItem(id, displayName, avatarUrl)
override val avatarUrl: String? = null)
: MatrixItem(id, displayName?.removeSuffix(ircPattern), avatarUrl)
data class EventItem(override val id: String,
override val displayName: String? = null,
@ -59,7 +59,7 @@ sealed class MatrixItem(
/**
* Return the prefix as defined in the matrix spec (and not extracted from the id)
*/
fun getPrefix() = when (this) {
fun getIdPrefix() = when (this) {
is UserItem -> '@'
is EventItem -> '$'
is RoomItem -> '!'
@ -103,6 +103,8 @@ sealed class MatrixItem(
companion object {
private const val ircPattern = " (IRC)"
fun from(user: User) = UserItem(user.userId, user.displayName, user.avatarUrl)
fun from(groupSummary: GroupSummary) = GroupItem(groupSummary.groupId, groupSummary.displayName, groupSummary.avatarUrl)
fun from(roomSummary: RoomSummary) = RoomItem(roomSummary.roomId, roomSummary.displayName, roomSummary.avatarUrl)