Unverified Commit ed5e1d19 authored by Lucio Maciel's avatar Lucio Maciel Committed by GitHub

Merge pull request #1501 from RocketChat/fix/fix-fullname-on-chatrooms

[FIX] fix fullname on chatrooms
parents 107e5f7c 35decfd6
...@@ -251,10 +251,18 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -251,10 +251,18 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
setReactionButtonIcon(R.drawable.ic_reaction_24dp) setReactionButtonIcon(R.drawable.ic_reaction_24dp)
emojiKeyboardPopup.dismiss() dismissEmojiKeyboard()
activity?.invalidateOptionsMenu() activity?.invalidateOptionsMenu()
} }
private fun dismissEmojiKeyboard() {
// Check if the keyboard was ever initialized.
// It may be the case when you are looking a not joined room
if (::emojiKeyboardPopup.isInitialized) {
emojiKeyboardPopup.dismiss()
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
if (resultData != null && resultCode == Activity.RESULT_OK) { if (resultData != null && resultCode == Activity.RESULT_OK) {
when (requestCode) { when (requestCode) {
......
...@@ -68,13 +68,15 @@ class RoomUiModelMapper( ...@@ -68,13 +68,15 @@ class RoomUiModelMapper(
val name = mapName(user.username!!, user.name, false) val name = mapName(user.username!!, user.name, false)
val status = user.status val status = user.status
val avatar = serverUrl.avatarUrl(user.username!!) val avatar = serverUrl.avatarUrl(user.username!!)
val username = user.username!!
RoomUiModel( RoomUiModel(
id = user.id, id = user.id,
name = name, name = name,
type = roomTypeOf(RoomType.DIRECT_MESSAGE), type = roomTypeOf(RoomType.DIRECT_MESSAGE),
avatar = avatar, avatar = avatar,
status = status status = status,
username = username
) )
} }
} }
...@@ -97,7 +99,7 @@ class RoomUiModelMapper( ...@@ -97,7 +99,7 @@ class RoomUiModelMapper(
val isUnread = alert || unread > 0 val isUnread = alert || unread > 0
val type = roomTypeOf(type) val type = roomTypeOf(type)
val status = chatRoom.status?.let { userStatusOf(it) } val status = chatRoom.status?.let { userStatusOf(it) }
val roomName = mapName(name, chatRoom.userFullname, isUnread) val roomName = mapName(name, fullname, isUnread)
val timestamp = mapDate(lastMessageTimestamp ?: updatedAt, isUnread) val timestamp = mapDate(lastMessageTimestamp ?: updatedAt, isUnread)
val avatar = if (type is RoomType.DirectMessage) { val avatar = if (type is RoomType.DirectMessage) {
serverUrl.avatarUrl(name) serverUrl.avatarUrl(name)
...@@ -117,7 +119,8 @@ class RoomUiModelMapper( ...@@ -117,7 +119,8 @@ class RoomUiModelMapper(
unread = unread, unread = unread,
alert = isUnread, alert = isUnread,
lastMessage = lastMessage, lastMessage = lastMessage,
status = status status = status,
username = if (type is RoomType.DirectMessage) name else null
) )
} }
} }
......
...@@ -12,5 +12,6 @@ data class RoomUiModel( ...@@ -12,5 +12,6 @@ data class RoomUiModel(
val unread: String? = null, val unread: String? = null,
val alert: Boolean = false, val alert: Boolean = false,
val lastMessage: CharSequence? = null, val lastMessage: CharSequence? = null,
val status: UserStatus? = null val status: UserStatus? = null,
val username: String? = null
) )
\ No newline at end of file
...@@ -51,7 +51,8 @@ class ChatRoomsPresenter @Inject constructor( ...@@ -51,7 +51,8 @@ class ChatRoomsPresenter @Inject constructor(
id = id, id = id,
subscriptionId = "", subscriptionId = "",
type = type.toString(), type = type.toString(),
name = name.toString(), name = username ?: name.toString(),
fullname = name.toString(),
open = false open = false
) )
loadChatRoom(entity) loadChatRoom(entity)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment