Hide verbose state events from the timeline (#2225)

This commit is contained in:
Jorge Martin Espinosa 2024-01-12 22:23:52 +01:00 committed by GitHub
parent 0b859209e2
commit 4a7b04524a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 157 additions and 4 deletions

View file

@ -85,7 +85,11 @@ data class ProfileChangeContent(
data class StateContent(
val stateKey: String,
val content: OtherState
) : EventContent
) : EventContent {
fun isVisibleInTimeline(): Boolean {
return content.isVisibleInTimeline()
}
}
data class FailedToParseMessageLikeContent(
val eventType: String,

View file

@ -41,4 +41,30 @@ sealed interface OtherState {
data object SpaceChild : OtherState
data object SpaceParent : OtherState
data class Custom(val eventType: String) : OtherState
fun isVisibleInTimeline() = when (this) {
// Visible
is RoomAvatar,
is RoomName,
is RoomTopic,
is RoomThirdPartyInvite,
is RoomCreate,
is RoomEncryption,
is Custom -> true
// Hidden
is RoomAliases,
is RoomCanonicalAlias,
is RoomGuestAccess,
is RoomHistoryVisibility,
is RoomJoinRules,
is RoomPinnedEvents,
is RoomPowerLevels,
is RoomServerAcl,
is RoomTombstone,
is SpaceChild,
is SpaceParent,
is PolicyRuleRoom,
is PolicyRuleServer,
is PolicyRuleUser -> false
}
}