Skip to content

Commit

Permalink
reduce if nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinaboos committed Oct 11, 2024
1 parent 9c2f2f7 commit 36a1116
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/home/room_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1169,18 +1169,16 @@ impl Widget for RoomScreen {
// Handle the action that requests to show the user profile sliding pane.
if let ShowUserProfileAction::ShowUserProfile(profile_and_room_id) = action.as_widget_action().cast() {
// Only show the user profile in room that this avatar belongs to
if let Some(room_id) = self.room_id.as_ref() {
if profile_and_room_id.room_id == *room_id {
self.show_user_profile(
cx,
&pane,
UserProfilePaneInfo {
profile_and_room_id,
room_name: self.room_name.clone(),
room_member: None,
},
);
}
if self.room_id.as_ref().is_some_and(|r| r == &profile_and_room_id.room_id) {
self.show_user_profile(
cx,
&pane,
UserProfilePaneInfo {
profile_and_room_id,
room_name: self.room_name.clone(),
room_member: None,
},
);
}
}

Expand Down

0 comments on commit 36a1116

Please sign in to comment.