add rekeys, refounding and dissolution

This commit is contained in:
2026-09-17 08:16:41 +07:00
parent 79a4dd387d
commit ecd08273eb
8 changed files with 2035 additions and 44 deletions
+2 -4
View File
@@ -43,7 +43,6 @@ impl fmt::Display for ListError {
impl std::error::Error for ListError {}
/// A membership's keys.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct JoinMaterial {
pub community_id: CommunityId,
@@ -83,7 +82,6 @@ pub struct Tombstone {
pub extra: Extra,
}
/// A member's own memberships.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CommunityList {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
@@ -242,7 +240,7 @@ fn pick<'a>(
held
}
fn union(into: &mut Extra, other: Extra) {
pub(crate) fn union(into: &mut Extra, other: Extra) {
for (key, value) in other {
let replace = match into.get(&key) {
Some(existing) => canonical(&value) < canonical(existing),
@@ -255,7 +253,7 @@ fn union(into: &mut Extra, other: Extra) {
}
}
fn canonical<T: Serialize>(value: &T) -> String {
pub(crate) fn canonical<T: Serialize>(value: &T) -> String {
serde_json::to_string(value).unwrap_or_default()
}