Bring back notices for kicks

Change-Id: I8bac582658fc2e2b0829c4ee15e251f88d972d80
This commit is contained in:
SpiritCroc 2021-11-16 15:56:47 +01:00
parent 4248ec163f
commit 7aec888940
1 changed files with 9 additions and 4 deletions

View File

@ -119,8 +119,7 @@ class TimelineEventVisibilityHelper @Inject constructor(private val userPreferen
val diff = computeMembershipDiff() val diff = computeMembershipDiff()
if ((diff.isJoin || diff.isPart) && !userPreferencesProvider.shouldShowJoinLeaves()) return true if ((diff.isJoin || diff.isPart) && !userPreferencesProvider.shouldShowJoinLeaves()) return true
if ((diff.isAvatarChange || diff.isDisplaynameChange) && !userPreferencesProvider.shouldShowAvatarDisplayNameChanges()) return true if ((diff.isAvatarChange || diff.isDisplaynameChange) && !userPreferencesProvider.shouldShowAvatarDisplayNameChanges()) return true
// No change if (diff.isNoChange) return true
if (!diff.isJoin && !diff.isPart && !diff.isDisplaynameChange && !diff.isAvatarChange) return true
} }
return false return false
} }
@ -137,11 +136,16 @@ class TimelineEventVisibilityHelper @Inject constructor(private val userPreferen
val isDisplaynameChange = isProfileChanged && content?.displayName != prevContent?.displayName val isDisplaynameChange = isProfileChanged && content?.displayName != prevContent?.displayName
val isAvatarChange = isProfileChanged && content?.avatarUrl != prevContent?.avatarUrl val isAvatarChange = isProfileChanged && content?.avatarUrl != prevContent?.avatarUrl
// Compare NoticeEventFormatter.formatRoomMemberEvent()
val isMembershipEvent = prevContent?.membership != content?.membership ||
content?.membership == Membership.LEAVE
return MembershipDiff( return MembershipDiff(
isJoin = isJoin, isJoin = isJoin,
isPart = isPart, isPart = isPart,
isDisplaynameChange = isDisplaynameChange, 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 isJoin: Boolean,
val isPart: Boolean, val isPart: Boolean,
val isDisplaynameChange: Boolean, val isDisplaynameChange: Boolean,
val isAvatarChange: Boolean val isAvatarChange: Boolean,
val isNoChange: Boolean
) )
} }