Skip to content

Commit

Permalink
Add has_pending_commit function to Group
Browse files Browse the repository at this point in the history
  • Loading branch information
tomleavy committed Apr 3, 2024
1 parent 8f7d38b commit 754a6b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mls-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mls-rs"
version = "0.39.0"
version = "0.39.1"
edition = "2021"
description = "An implementation of Messaging Layer Security (RFC 9420)"
homepage = "https://github.com/awslabs/mls-rs"
Expand Down
10 changes: 10 additions & 0 deletions mls-rs/src/group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,12 @@ where
self.process_commit(pending_commit.content, None).await
}

/// Returns true if a commit has been created but not yet applied
/// with [`Group::apply_pending_commit`] or cleared with [`Group::clear_pending_commit`]
pub fn has_pending_commit(&self) -> bool {
self.pending_commit.is_some()
}

/// Clear the currently pending commit.
///
/// This function will automatically be called in the event that a
Expand Down Expand Up @@ -1936,6 +1942,8 @@ mod tests {
#[cfg(feature = "by_ref_proposal")]
assert!(group.pending_updates.is_empty());

assert!(!group.has_pending_commit());

assert_eq!(
group.private_tree.self_index.0,
group.current_member_index()
Expand Down Expand Up @@ -1974,6 +1982,8 @@ mod tests {
// We should be able to send application messages after a commit
test_group.group.commit(vec![]).await.unwrap();

assert!(test_group.group.has_pending_commit());

test_group.group.apply_pending_commit().await.unwrap();

let res = test_group
Expand Down

0 comments on commit 754a6b5

Please sign in to comment.