[fractal] member: Update member from event with state key instead of sender
- From: Kévin Commaille <kcommaille src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] member: Update member from event with state key instead of sender
- Date: Tue, 26 Apr 2022 12:39:23 +0000 (UTC)
commit 11f7abd1ae2b5bc3e61b008a48512c55ac2c9491
Author: Kévin Commaille <zecakeh tedomum fr>
Date: Sat Apr 23 12:04:08 2022 +0200
member: Update member from event with state key instead of sender
src/session/room/member_list.rs | 5 +++--
src/session/room/mod.rs | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/session/room/member_list.rs b/src/session/room/member_list.rs
index e37c93174..63f237c4b 100644
--- a/src/session/room/member_list.rs
+++ b/src/session/room/member_list.rs
@@ -155,8 +155,9 @@ impl MemberList {
/// Creates a new member first if there is no member matching the given
/// event.
pub fn update_member_for_member_event(&self, event: &SyncStateEvent<RoomMemberEventContent>) {
- self.member_by_id(event.sender.clone().into())
- .update_from_member_event(event);
+ if let Ok(user_id) = UserId::parse_arc(event.state_key.as_str()) {
+ self.member_by_id(user_id).update_from_member_event(event);
+ }
}
/// Returns whether the given user id is present in `MemberList`
diff --git a/src/session/room/mod.rs b/src/session/room/mod.rs
index fe8f30953..c13f59f57 100644
--- a/src/session/room/mod.rs
+++ b/src/session/room/mod.rs
@@ -1023,7 +1023,7 @@ impl Room {
let inviter_event = events.iter().find(|event| {
if let AnyStrippedStateEvent::RoomMember(event) = event {
- event.sender == inviter_id
+ event.state_key == inviter_id.as_str()
} else {
false
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]