Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

[FIX] fix fullname on chatrooms #1501

Merged
merged 2 commits into from Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -251,10 +251,18 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override fun onPause() {
super.onPause()
setReactionButtonIcon(R.drawable.ic_reaction_24dp)
emojiKeyboardPopup.dismiss()
dismissEmojiKeyboard()
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?) {
if (resultData != null && resultCode == Activity.RESULT_OK) {
when (requestCode) {
Expand Down
Expand Up @@ -68,13 +68,15 @@ class RoomUiModelMapper(
val name = mapName(user.username!!, user.name, false)
val status = user.status
val avatar = serverUrl.avatarUrl(user.username!!)
val username = user.username!!

RoomUiModel(
id = user.id,
name = name,
type = roomTypeOf(RoomType.DIRECT_MESSAGE),
avatar = avatar,
status = status
status = status,
username = username
)
}
}
Expand All @@ -97,7 +99,7 @@ class RoomUiModelMapper(
val isUnread = alert || unread > 0
val type = roomTypeOf(type)
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 avatar = if (type is RoomType.DirectMessage) {
serverUrl.avatarUrl(name)
Expand All @@ -117,7 +119,8 @@ class RoomUiModelMapper(
unread = unread,
alert = isUnread,
lastMessage = lastMessage,
status = status
status = status,
username = if (type is RoomType.DirectMessage) name else null
)
}
}
Expand Down
Expand Up @@ -12,5 +12,6 @@ data class RoomUiModel(
val unread: String? = null,
val alert: Boolean = false,
val lastMessage: CharSequence? = null,
val status: UserStatus? = null
val status: UserStatus? = null,
val username: String? = null
)
Expand Up @@ -51,7 +51,8 @@ class ChatRoomsPresenter @Inject constructor(
id = id,
subscriptionId = "",
type = type.toString(),
name = name.toString(),
name = username ?: name.toString(),
fullname = name.toString(),
open = false
)
loadChatRoom(entity)
Expand Down