state-res: Fix up doc comments

This commit is contained in:
Jonas Platte 2021-09-03 20:28:14 +02:00
parent 4bea59caef
commit a56814a4f4
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -16,8 +16,8 @@ use tracing::{debug, info, warn};
use crate::{room_version::RoomVersion, Error, Event, Result, StateMap};
/// For the given event `kind` what are the relevant auth events
/// that are needed to authenticate this `content`.
/// For the given event `kind` what are the relevant auth events that are needed to authenticate
/// this `content`.
pub fn auth_types_for_event(
kind: &EventType,
sender: &UserId,
@ -70,16 +70,19 @@ pub fn auth_types_for_event(
auth_types
}
/// Authenticate the incoming `event`. The steps of authentication are:
/// Authenticate the incoming `event`.
///
/// The steps of authentication are:
///
/// * check that the event is being authenticated for the correct room
/// * check that the events signatures are valid
/// * then there are checks for specific event types
///
/// The `fetch_state` closure should gather state from a state snapshot.
/// We need to know if the event passes auth against some state not a recursive
/// collection of auth_events fields.
/// The `fetch_state` closure should gather state from a state snapshot. We need to know if the
/// event passes auth against some state not a recursive collection of auth_events fields.
///
/// ## Returns
///
/// This returns an `Error` only when serialization fails or some other fatal outcome.
pub fn auth_check<E, F>(
room_version: &RoomVersion,
@ -296,8 +299,9 @@ where
/// * `user` - Information about the membership event and user making the request.
/// * `prev_event` - The event that occurred immediately before the `user` event or None.
/// * `auth_events` - The set of auth events that relate to a membership event.
/// this is generated by calling `auth_types_for_event` with the membership event and
/// the current State.
///
/// This is generated by calling `auth_types_for_event` with the membership event and the current
/// State.
pub fn valid_membership_change<E, F>(
state_key: &str,
user_sender: &UserId,
@ -512,8 +516,9 @@ where
Some(membership == MembershipState::Join)
}
/// Is the user allowed to send a specific event based on the rooms power levels. Does the event
/// have the correct userId as it's state_key if it's not the "" state_key.
/// Is the user allowed to send a specific event based on the rooms power levels.
///
/// Does the event have the correct userId as its state_key if it's not the "" state_key.
pub fn can_send_event<E, F>(event: &Arc<E>, fetch_state: F) -> bool
where
E: Event,