summaryrefslogtreecommitdiffstats
path: root/src/federation/client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/federation/client.rs')
-rw-r--r--src/federation/client.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/federation/client.rs b/src/federation/client.rs
index 4d61944..7b9d3d7 100644
--- a/src/federation/client.rs
+++ b/src/federation/client.rs
@@ -433,7 +433,8 @@ pub(crate) fn binding(
/// What the version `proposed` changes of `current`, a line each: each field whose value
/// differs, and of `keys` and `nodes` each party's, as `field: before -> after`, its JCS
-/// on either side, `-` where a version lacks it.
+/// on either side, `-` where a version lacks it; the revision as people read it
+/// (`revision::described`).
pub(crate) fn changes(current: &Json, proposed: &Json) -> Vec<String> {
fn text(json: Option<&Json>) -> String {
json.map_or_else(
@@ -450,6 +451,14 @@ pub(crate) fn changes(current: &Json, proposed: &Json) -> Vec<String> {
if before == after {
continue;
}
+ if name == "revision" {
+ lines.push(format!(
+ "revision: {} -> {}",
+ super::revision::described(before),
+ super::revision::described(after)
+ ));
+ continue;
+ }
let by_party = matches!(name, "keys" | "nodes")
&& [before, after]
.iter()
@@ -887,5 +896,16 @@ mod tests {
]
);
assert!(changes(&current, &current).is_empty());
+ let one = super::super::revision::Revision(1).id();
+ let revised = read(&format!(
+ r#"{{"number": 0, "changes": null, "keys": {{"tv": {{"since": 0, "keys": ["a"]}}}},
+ "revision": "{one}", "rules": []}}"#
+ ));
+ assert_eq!(
+ changes(&current, &revised),
+ [format!(
+ "revision: the base revision -> revision 1 (merge-events), {one}"
+ )]
+ );
}
}