Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add has_pending_commit function to Group #140

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading