Revert "add_member provably always returns true."

This reverts commit 7943baee49.
master
Denis Kasak 2020-07-10 15:07:17 +02:00
parent 7943baee49
commit e70929317a
1 changed files with 7 additions and 7 deletions

View File

@ -358,7 +358,9 @@ impl Room {
} }
/// Process the member event of an entering user. /// 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); let new_member = RoomMember::new(event);
match event.membership_change() { match event.membership_change() {
@ -383,15 +385,15 @@ impl Room {
}; };
// Perform display name disambiguations, if necessary. // Perform display name disambiguations, if necessary.
let disambiguations = let disambiguations = self.disambiguation_updates(&new_member, MemberDirection::Entering);
self.disambiguation_updates(&new_member, MemberDirection::Entering);
for (id, name) in disambiguations.into_iter() { for (id, name) in disambiguations.into_iter() {
match name { match name {
None => self.disambiguated_display_names.remove(&id), None => self.disambiguated_display_names.remove(&id),
Some(name) => self.disambiguated_display_names.insert(id, name), Some(name) => self.disambiguated_display_names.insert(id, name),
}; };
} }
true
} }
/// Process the member event of a leaving user. /// Process the member event of a leaving user.
@ -582,9 +584,7 @@ impl Room {
match event.membership_change() { match event.membership_change() {
Invited | Joined => { Invited | Joined => {
self.add_member(event); self.add_member(event)
true
} }
Kicked | Banned | KickedAndBanned | InvitationRejected | Left => { Kicked | Banned | KickedAndBanned | InvitationRejected | Left => {
self.remove_member(event) self.remove_member(event)