From 7aec888940e92596d9196650037860e4084c505f Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Tue, 16 Nov 2021 15:56:47 +0100 Subject: [PATCH] Bring back notices for kicks Change-Id: I8bac582658fc2e2b0829c4ee15e251f88d972d80 --- .../helper/TimelineEventVisibilityHelper.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventVisibilityHelper.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventVisibilityHelper.kt index db65653ac5..0944d89321 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventVisibilityHelper.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventVisibilityHelper.kt @@ -119,8 +119,7 @@ class TimelineEventVisibilityHelper @Inject constructor(private val userPreferen val diff = computeMembershipDiff() if ((diff.isJoin || diff.isPart) && !userPreferencesProvider.shouldShowJoinLeaves()) return true if ((diff.isAvatarChange || diff.isDisplaynameChange) && !userPreferencesProvider.shouldShowAvatarDisplayNameChanges()) return true - // No change - if (!diff.isJoin && !diff.isPart && !diff.isDisplaynameChange && !diff.isAvatarChange) return true + if (diff.isNoChange) return true } return false } @@ -137,11 +136,16 @@ class TimelineEventVisibilityHelper @Inject constructor(private val userPreferen val isDisplaynameChange = isProfileChanged && content?.displayName != prevContent?.displayName val isAvatarChange = isProfileChanged && content?.avatarUrl != prevContent?.avatarUrl + // Compare NoticeEventFormatter.formatRoomMemberEvent() + val isMembershipEvent = prevContent?.membership != content?.membership || + content?.membership == Membership.LEAVE + return MembershipDiff( isJoin = isJoin, isPart = isPart, isDisplaynameChange = isDisplaynameChange, - isAvatarChange = isAvatarChange + isAvatarChange = isAvatarChange, + isNoChange = !isMembershipEvent && !isJoin && !isPart && !isDisplaynameChange && !isAvatarChange ) } @@ -149,6 +153,7 @@ class TimelineEventVisibilityHelper @Inject constructor(private val userPreferen val isJoin: Boolean, val isPart: Boolean, val isDisplaynameChange: Boolean, - val isAvatarChange: Boolean + val isAvatarChange: Boolean, + val isNoChange: Boolean ) }