diff --git a/crates/matrix-sdk-ui/CHANGELOG.md b/crates/matrix-sdk-ui/CHANGELOG.md index 908df65b4e1..1be4ef45ec8 100644 --- a/crates/matrix-sdk-ui/CHANGELOG.md +++ b/crates/matrix-sdk-ui/CHANGELOG.md @@ -6,6 +6,13 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - ReleaseDate +### Bug Fixes + +- Don't consider rooms in the banned state to be non-left rooms. This bug was + introduced due to the introduction of the banned state for rooms, and the + non-left room filter did not take the new room stat into account. + ([#4448](https://github.com/matrix-org/matrix-rust-sdk/pull/4448)) + ## [0.9.0] - 2024-12-18 ### Bug Fixes diff --git a/crates/matrix-sdk-ui/src/room_list_service/filters/non_left.rs b/crates/matrix-sdk-ui/src/room_list_service/filters/non_left.rs index 8f59575a787..05ceccd361c 100644 --- a/crates/matrix-sdk-ui/src/room_list_service/filters/non_left.rs +++ b/crates/matrix-sdk-ui/src/room_list_service/filters/non_left.rs @@ -28,7 +28,10 @@ where F: Fn(&Room) -> RoomState, { fn matches(&self, room: &Room) -> bool { - (self.state)(room) != RoomState::Left + match (self.state)(room) { + RoomState::Joined | RoomState::Invited | RoomState::Knocked => true, + RoomState::Left | RoomState::Banned => false, + } } } @@ -59,6 +62,10 @@ mod tests { let matcher = NonLeftRoomMatcher { state: |_| RoomState::Left }; assert!(!matcher.matches(&room)); + // When a room is in the banned state, it doesn't match either. + let matcher = NonLeftRoomMatcher { state: |_| RoomState::Banned }; + assert!(!matcher.matches(&room)); + // When a room has been joined, it does match (unless it's empty). let matcher = NonLeftRoomMatcher { state: |_| RoomState::Joined }; assert!(matcher.matches(&room));