Fix member state setting filter

What we want with that setting:
- When enabled, include all member state events
- When disable, exclude all member state events

What it did:
- When enabled, exclude all member state events except from the
  logged-in user
- When disabled, include all member state events

Change-Id: I86eec2188163dc3265444e121d230ce0cb9c7f7a
This commit is contained in:
SpiritCroc 2020-12-26 14:28:42 +01:00
parent 7c5d49909c
commit 8c2dbc342b

View file

@ -54,11 +54,15 @@ class TimelineSettingsFactory @Inject constructor(
}
private fun List<String>.createAllowedEventTypeFilters(): List<EventTypeFilter> {
return map {
var result = map {
EventTypeFilter(
eventType = it,
stateKey = if (it == EventType.STATE_ROOM_MEMBER && userPreferencesProvider.shouldShowRoomMemberStateEvents()) session.myUserId else null
stateKey = null
)
}
if (!userPreferencesProvider.shouldShowRoomMemberStateEvents()) {
result = result.filter { it.eventType != EventType.STATE_ROOM_MEMBER }
}
return result
}
}