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.
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)