From 063c35380a5ab61c8caf08efb0067638ac45fb78 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 4 Jul 2019 16:44:37 +0200 Subject: [PATCH] Fix regression on invitation full screen display --- .../features/home/room/detail/RoomDetailViewModel.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt index 96c2a7cf..d5d5ffa3 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt @@ -44,6 +44,8 @@ import im.vector.riotx.core.utils.LiveEvent import im.vector.riotx.features.command.CommandParser import im.vector.riotx.features.command.ParsedCommand import im.vector.riotx.features.home.room.detail.timeline.helper.TimelineDisplayableEvents +import io.reactivex.Observable +import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.rxkotlin.subscribeBy import org.commonmark.parser.Parser import org.commonmark.renderer.html.HtmlRenderer @@ -499,6 +501,16 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro private fun observeRoomSummary() { room.rx().liveRoomSummary(false) + .observeOn(AndroidSchedulers.mainThread()) + .flatMap { + if (it.membership != Membership.INVITE || it.latestEvent != null) { + // Not an invitation, or already fetching last event + Observable.just(it) + } else { + // We need the last event + room.rx().liveRoomSummary(true) + } + } .execute { async -> copy( asyncRoomSummary = async,