Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): Consider banned rooms as rooms we left in the non-left rooms matcher #4448

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/matrix-sdk-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}

Expand Down Expand Up @@ -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));
Expand Down
Loading