state-res: Add some docs and fix a typo

This commit is contained in:
Devin Ragotzy 2021-10-04 16:05:11 -04:00 committed by Jonas Platte
parent 0e1cf5b3f6
commit bdce12b07e
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
2 changed files with 5 additions and 1 deletions

View File

@ -161,7 +161,7 @@ impl Restricted {
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[serde(tag = "type")] #[serde(tag = "type")]
pub enum AllowRule { pub enum AllowRule {
/// Joining is allowed if a user is already a member of the romm with the id `room_id`. /// Joining is allowed if a user is already a member of the room with the id `room_id`.
#[serde(rename = "m.room_membership")] #[serde(rename = "m.room_membership")]
RoomMembership(RoomMembership), RoomMembership(RoomMembership),

View File

@ -331,6 +331,10 @@ struct PowerLevelsContentFields {
} }
/// Find the power level for the sender of `event_id` or return a default value of zero. /// Find the power level for the sender of `event_id` or return a default value of zero.
///
/// Do NOT use this any where but topological sort, we find the power level for the eventId
/// at the eventId's generation (we walk backwards to `EventId`s most recent previous power level
/// event).
fn get_power_level_for_sender<E: Event>( fn get_power_level_for_sender<E: Event>(
event_id: &EventId, event_id: &EventId,
fetch_event: impl Fn(&EventId) -> Option<E>, fetch_event: impl Fn(&EventId) -> Option<E>,