Skip to content

Commit

Permalink
ffi: Add the user's display name to RoomMembership timeline content
Browse files Browse the repository at this point in the history
This is useful to properly format membership state events.
  • Loading branch information
jmartinesp authored and bnjbvr committed May 17, 2024
1 parent a48d604 commit 3914e31
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bindings/matrix-sdk-ffi/src/timeline/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use std::{collections::HashMap, sync::Arc};

use matrix_sdk::{crypto::types::events::UtdCause, room::power_levels::power_level_user_changes};
use matrix_sdk_ui::timeline::{PollResult, TimelineDetails};
use ruma::events::FullStateEventContent;
use tracing::warn;

use super::ProfileDetails;
Expand Down Expand Up @@ -47,6 +48,13 @@ impl TimelineItemContent {
}
Content::MembershipChange(membership) => TimelineItemContentKind::RoomMembership {
user_id: membership.user_id().to_string(),
user_display_name: if let FullStateEventContent::Original { content, .. } =
membership.content()
{
content.displayname.clone()
} else {
None
},
change: membership.change().map(Into::into),
},
Content::ProfileChange(profile) => {
Expand Down Expand Up @@ -120,6 +128,7 @@ pub enum TimelineItemContentKind {
},
RoomMembership {
user_id: String,
user_display_name: Option<String>,
change: Option<MembershipChange>,
},
ProfileChange {
Expand Down

0 comments on commit 3914e31

Please sign in to comment.