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 🐛: Bugfix 🐛:
- Scroll breadcrumbs to top when opened - Scroll breadcrumbs to top when opened
- Render default room name when it starts with an emoji (#477) - 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 🗣: Translations 🗣:
- -

View File

@ -29,8 +29,8 @@ sealed class MatrixItem(
) { ) {
data class UserItem(override val id: String, data class UserItem(override val id: String,
override val displayName: String? = null, override val displayName: String? = null,
override val avatarUrl: String? = null override val avatarUrl: String? = null)
) : MatrixItem(id, displayName, avatarUrl) : MatrixItem(id, displayName?.removeSuffix(ircPattern), avatarUrl)
data class EventItem(override val id: String, data class EventItem(override val id: String,
override val displayName: String? = null, 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) * 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 UserItem -> '@'
is EventItem -> '$' is EventItem -> '$'
is RoomItem -> '!' is RoomItem -> '!'
@ -103,6 +103,8 @@ sealed class MatrixItem(
companion object { companion object {
private const val ircPattern = " (IRC)"
fun from(user: User) = UserItem(user.userId, user.displayName, user.avatarUrl) fun from(user: User) = UserItem(user.userId, user.displayName, user.avatarUrl)
fun from(groupSummary: GroupSummary) = GroupItem(groupSummary.groupId, groupSummary.displayName, groupSummary.avatarUrl) fun from(groupSummary: GroupSummary) = GroupItem(groupSummary.groupId, groupSummary.displayName, groupSummary.avatarUrl)
fun from(roomSummary: RoomSummary) = RoomItem(roomSummary.roomId, roomSummary.displayName, roomSummary.avatarUrl) fun from(roomSummary: RoomSummary) = RoomItem(roomSummary.roomId, roomSummary.displayName, roomSummary.avatarUrl)