diff --git a/matrix-sdk-android/src/main/res/values/strings.xml b/matrix-sdk-android/src/main/res/values/strings.xml
index de70b21695..50169fd982 100644
--- a/matrix-sdk-android/src/main/res/values/strings.xml
+++ b/matrix-sdk-android/src/main/res/values/strings.xml
@@ -7,8 +7,8 @@
%s\'s invitation
%1$s invited %2$s
%1$s invited you
- %1$s joined
- %1$s left
+ %1$s joined the room
+ %1$s left the room
%1$s rejected the invitation
%1$s kicked %2$s
%1$s unbanned %2$s
@@ -246,8 +246,8 @@
%1$s\'s invitation. Reason: %2$s
%1$s invited %2$s. Reason: %3$s
%1$s invited you. Reason: %2$s
- %1$s joined. Reason: %2$s
- %1$s left. Reason: %2$s
+ %1$s joined the room. Reason: %2$s
+ %1$s left the room. Reason: %2$s
%1$s rejected the invitation. Reason: %2$s
%1$s kicked %2$s. Reason: %3$s
%1$s unbanned %2$s. Reason: %3$s
diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt
index 377fc5ab4a..03c273800a 100644
--- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt
+++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt
@@ -18,6 +18,7 @@ package im.vector.riotx.features.home.room.detail.timeline.factory
import im.vector.matrix.android.api.session.events.model.EventType
import im.vector.matrix.android.api.session.events.model.toModel
+import im.vector.matrix.android.api.session.room.model.create.RoomCreateContent
import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
import im.vector.matrix.android.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM
import im.vector.matrix.android.internal.crypto.model.event.EncryptionEventContent
@@ -43,6 +44,9 @@ class MergedHeaderItemFactory @Inject constructor(private val sessionHolder: Act
private val collapsedEventIds = linkedSetOf()
private val mergeItemCollapseStates = HashMap()
+ /**
+ * Note: nextEvent is an older event than event
+ */
fun create(event: TimelineEvent,
nextEvent: TimelineEvent?,
items: List,
@@ -52,7 +56,8 @@ class MergedHeaderItemFactory @Inject constructor(private val sessionHolder: Act
callback: TimelineEventController.Callback?,
requestModelBuild: () -> Unit)
: BasedMergedItem<*>? {
- return if (nextEvent?.root?.getClearType() == EventType.STATE_ROOM_CREATE && event.isRoomConfiguration()) {
+ return if (nextEvent?.root?.getClearType() == EventType.STATE_ROOM_CREATE
+ && event.isRoomConfiguration(nextEvent.root.getClearContent()?.toModel()?.creator)) {
// It's the first item before room.create
// Collapse all room configuration events
buildRoomCreationMergedSummary(currentPosition, items, event, eventIdToHighlight, requestModelBuild, callback)
@@ -127,7 +132,7 @@ class MergedHeaderItemFactory @Inject constructor(private val sessionHolder: Act
val mergedEvents = ArrayList().also { it.add(event) }
var hasEncryption = false
var encryptionAlgorithm: String? = null
- while (prevEvent != null && prevEvent.isRoomConfiguration()) {
+ while (prevEvent != null && prevEvent.isRoomConfiguration(null)) {
if (prevEvent.root.getClearType() == EventType.STATE_ROOM_ENCRYPTION) {
hasEncryption = true
encryptionAlgorithm = prevEvent.root.getClearContent()?.toModel()?.algorithm
diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/TimelineDisplayableEvents.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/TimelineDisplayableEvents.kt
index 1ea3cd64ac..f1106d276e 100644
--- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/TimelineDisplayableEvents.kt
+++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/TimelineDisplayableEvents.kt
@@ -50,14 +50,23 @@ fun TimelineEvent.canBeMerged(): Boolean {
return root.getClearType() == EventType.STATE_ROOM_MEMBER
}
-fun TimelineEvent.isRoomConfiguration(): Boolean {
+fun TimelineEvent.isRoomConfiguration(roomCreatorUserId: String?): Boolean {
return when (root.getClearType()) {
EventType.STATE_ROOM_GUEST_ACCESS,
EventType.STATE_ROOM_HISTORY_VISIBILITY,
EventType.STATE_ROOM_JOIN_RULES,
- EventType.STATE_ROOM_MEMBER,
EventType.STATE_ROOM_NAME,
+ EventType.STATE_ROOM_TOPIC,
+ EventType.STATE_ROOM_AVATAR,
+ EventType.STATE_ROOM_ALIASES,
+ EventType.STATE_ROOM_CANONICAL_ALIAS,
+ EventType.STATE_ROOM_POWER_LEVELS,
EventType.STATE_ROOM_ENCRYPTION -> true
+ EventType.STATE_ROOM_MEMBER -> {
+ // Keep only room member events regarding the room creator (when he joined the room),
+ // but exclude events where the room creator invite others, or where others join
+ roomCreatorUserId != null && root.stateKey == roomCreatorUserId
+ }
else -> false
}
}
diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MergedRoomCreationItem.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MergedRoomCreationItem.kt
index 81050194a8..3985b3856b 100644
--- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MergedRoomCreationItem.kt
+++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MergedRoomCreationItem.kt
@@ -43,7 +43,8 @@ abstract class MergedRoomCreationItem : BasedMergedItem