Skip to content

Commit 90bb693

Browse files
committed
feat[ffi]: expose join_rules in OtherState::RoomJoinRules
1 parent 1db4a4c commit 90bb693

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

bindings/matrix-sdk-ffi/src/timeline/content.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use ruma::events::{
2020
room::history_visibility::HistoryVisibility as RumaHistoryVisibility, FullStateEventContent,
2121
};
2222

23-
use crate::{timeline::msg_like::MsgLikeContent, utils::Timestamp};
23+
use crate::{client::JoinRule, timeline::msg_like::MsgLikeContent, utils::Timestamp};
2424

2525
impl From<matrix_sdk_ui::timeline::TimelineItemContent> for TimelineItemContent {
2626
fn from(value: matrix_sdk_ui::timeline::TimelineItemContent) -> Self {
@@ -254,7 +254,7 @@ pub enum OtherState {
254254
RoomEncryption,
255255
RoomGuestAccess,
256256
RoomHistoryVisibility { history_visibility: Option<HistoryVisibility> },
257-
RoomJoinRules,
257+
RoomJoinRules { join_rule: Option<JoinRule> },
258258
RoomName { name: Option<String> },
259259
RoomPinnedEvents { change: RoomPinnedEventsChange },
260260
RoomPowerLevels { users: HashMap<String, i64>, previous: Option<HashMap<String, i64>> },
@@ -305,7 +305,21 @@ impl From<&matrix_sdk_ui::timeline::AnyOtherFullStateEventContent> for OtherStat
305305
};
306306
Self::RoomHistoryVisibility { history_visibility }
307307
}
308-
Content::RoomJoinRules(_) => Self::RoomJoinRules,
308+
Content::RoomJoinRules(c) => {
309+
let join_rule = match c {
310+
FullContent::Original { content, .. } => {
311+
match content.join_rule.clone().try_into() {
312+
Ok(jr) => Some(jr),
313+
Err(err) => {
314+
tracing::error!("Failed to convert join rule: {}", err);
315+
None
316+
}
317+
}
318+
}
319+
FullContent::Redacted(_) => None,
320+
};
321+
Self::RoomJoinRules { join_rule }
322+
}
309323
Content::RoomName(c) => {
310324
let name = match c {
311325
FullContent::Original { content, .. } => Some(content.name.clone()),

0 commit comments

Comments
 (0)