Hot fix : makes room topic optional as it may be null.

This commit is contained in:
ganfra 2019-01-21 18:31:19 +01:00
parent c7c3a57c93
commit 32b29c47e7
2 changed files with 4 additions and 5 deletions

View File

@ -1,6 +1,5 @@
package im.vector.riotredesign.features.home.room.detail.timeline
import android.text.TextUtils
import im.vector.matrix.android.api.session.events.model.TimelineEvent
import im.vector.matrix.android.api.session.events.model.toModel
import im.vector.matrix.android.api.session.room.model.RoomTopicContent
@ -16,10 +15,10 @@ class RoomTopicItemFactory(private val stringProvider: StringProvider) {
if (content == null || roomMember == null) {
return null
}
val text = if (!TextUtils.isEmpty(content.topic)) {
stringProvider.getString(R.string.notice_room_topic_changed, roomMember.displayName, content.topic)
} else {
val text = if (content.topic.isNullOrEmpty()) {
stringProvider.getString(R.string.notice_room_topic_removed, roomMember.displayName)
} else {
stringProvider.getString(R.string.notice_room_topic_changed, roomMember.displayName, content.topic)
}
return NoticeItem(text, roomMember.avatarUrl, roomMember.displayName)
}

View File

@ -5,5 +5,5 @@ import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class RoomTopicContent(
@Json(name = "topic") val topic: String
@Json(name = "topic") val topic: String? = null
)