From e70929317ae0fa49f987bc1610cc8532846cc08e Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Fri, 10 Jul 2020 15:07:17 +0200 Subject: [PATCH] Revert "add_member provably always returns true." This reverts commit 7943baee49c578141ea5d2ff9313ca08d5569672. --- matrix_sdk_base/src/models/room.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/matrix_sdk_base/src/models/room.rs b/matrix_sdk_base/src/models/room.rs index e37c0dec..ea171660 100644 --- a/matrix_sdk_base/src/models/room.rs +++ b/matrix_sdk_base/src/models/room.rs @@ -358,7 +358,9 @@ impl Room { } /// Process the member event of an entering user. - fn add_member(&mut self, event: &MemberEvent) { + /// + /// Returns true if this made a change to the room's state, false otherwise. + fn add_member(&mut self, event: &MemberEvent) -> bool { let new_member = RoomMember::new(event); match event.membership_change() { @@ -383,15 +385,15 @@ impl Room { }; // Perform display name disambiguations, if necessary. - let disambiguations = - self.disambiguation_updates(&new_member, MemberDirection::Entering); - + let disambiguations = self.disambiguation_updates(&new_member, MemberDirection::Entering); for (id, name) in disambiguations.into_iter() { match name { None => self.disambiguated_display_names.remove(&id), Some(name) => self.disambiguated_display_names.insert(id, name), }; } + + true } /// Process the member event of a leaving user. @@ -582,9 +584,7 @@ impl Room { match event.membership_change() { Invited | Joined => { - self.add_member(event); - - true + self.add_member(event) } Kicked | Banned | KickedAndBanned | InvitationRejected | Left => { self.remove_member(event)