From cf0b331c3b342d4ea85716a62238241b90141399 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 6 Sep 2019 15:48:42 +0200 Subject: [PATCH] Handle invite to the current user rendering --- .../room/detail/timeline/format/NoticeEventFormatter.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt index 9a939a72..33306dcb 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt @@ -24,12 +24,14 @@ import im.vector.matrix.android.api.session.room.model.* import im.vector.matrix.android.api.session.room.model.call.CallInviteContent import im.vector.matrix.android.api.session.room.timeline.TimelineEvent import im.vector.riotx.R +import im.vector.riotx.core.di.ActiveSessionHolder import im.vector.riotx.core.resources.StringProvider import im.vector.riotx.features.home.room.detail.timeline.helper.senderName import timber.log.Timber import javax.inject.Inject -class NoticeEventFormatter @Inject constructor(private val stringProvider: StringProvider) { +class NoticeEventFormatter @Inject constructor(private val sessionHolder: ActiveSessionHolder, + private val stringProvider: StringProvider) { fun format(timelineEvent: TimelineEvent): CharSequence? { return when (val type = timelineEvent.root.getClearType()) { @@ -167,8 +169,7 @@ class NoticeEventFormatter @Inject constructor(private val stringProvider: Strin val targetDisplayName = eventContent?.displayName ?: prevEventContent?.displayName ?: "" return when { Membership.INVITE == eventContent?.membership -> { - // TODO get userId - val selfUserId = "" + val selfUserId = sessionHolder.getSafeActiveSession()?.myUserId when { eventContent.thirdPartyInvite != null -> { val userWhoHasAccepted = eventContent.thirdPartyInvite?.signed?.mxid ?: event.stateKey