Use numbers for LocalTime timestamps

Instead of using strings, use numbers.

*This is a breaking change and affects `config.json` parsing.*

To upgrade, simply unquote any number in your `config.json`.
This commit is contained in:
Alexis Sellier
2023-08-01 15:47:02 +02:00
parent a0c578604e
commit d45cce1df5
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -139,7 +139,7 @@ pub(crate) fn patch(
"discussions": rev.discussion().comments()
.map(|(id, comment)| Comment::new(id, comment, aliases))
.collect::<Vec<_>>(),
"timestamp": rev.timestamp().as_secs().to_string(),
"timestamp": rev.timestamp().as_secs(),
"reviews": rev.reviews().map(|(nid, _review)| review(nid, aliases.alias(nid), _review)).collect::<Vec<_>>(),
})
}).collect::<Vec<_>>(),
@@ -166,7 +166,7 @@ fn merge(merge: &Merge, nid: &NodeId, alias: Option<Alias>) -> Value {
"alias": alias,
},
"commit": merge.commit,
"timestamp": merge.timestamp.as_secs().to_string(),
"timestamp": merge.timestamp.as_secs(),
"revision": merge.revision,
}),
None => json!({
@@ -174,7 +174,7 @@ fn merge(merge: &Merge, nid: &NodeId, alias: Option<Alias>) -> Value {
"id": nid,
},
"commit": merge.commit,
"timestamp": merge.timestamp.as_secs().to_string(),
"timestamp": merge.timestamp.as_secs(),
"revision": merge.revision,
}),
}
@@ -191,7 +191,7 @@ fn review(nid: &NodeId, alias: Option<Alias>, review: &Review) -> Value {
"verdict": review.verdict(),
"summary": review.summary(),
"comments": review.comments().collect::<Vec<_>>(),
"timestamp": review.timestamp().as_secs().to_string(),
"timestamp": review.timestamp().as_secs(),
}),
None => json!({
"author": {
@@ -200,7 +200,7 @@ fn review(nid: &NodeId, alias: Option<Alias>, review: &Review) -> Value {
"verdict": review.verdict(),
"summary": review.summary(),
"comments": review.comments().collect::<Vec<_>>(),
"timestamp": review.timestamp().as_secs().to_string(),
"timestamp": review.timestamp().as_secs(),
}),
}
}
+2 -2
View File
@@ -37,7 +37,7 @@ pub const ISSUE_ID: &str = "5ad77fa3f476beed9a26f49b2b3b844e61bef792";
pub const ISSUE_DISCUSSION_ID: &str = "f1dff128a22e8183a23516dd9812e72e80914c92";
pub const ISSUE_COMMENT_ID: &str = "845218041bf9eb8155bfa4aaa8f0c91ce18e5c13";
pub const SESSION_ID: &str = "u9MGAkkfkMOv0uDDB2WeUHBT7HbsO2Dy";
pub const TIMESTAMP: &str = "1671125284";
pub const TIMESTAMP: u64 = 1671125284;
pub const CONTRIBUTOR_RID: &str = "rad:z4XaCmN3jLSeiMvW15YTDpNbDHFhG";
pub const CONTRIBUTOR_DID: &str = "did:key:z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8";
pub const CONTRIBUTOR_NID: &str = "z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8";
@@ -97,7 +97,7 @@ fn seed_with_signer<G: Signer>(dir: &Path, profile: radicle::Profile, signer: &G
let workdir = dir.join("hello-world");
env::set_var("RAD_COMMIT_TIME", TIMESTAMP);
env::set_var("RAD_COMMIT_TIME", TIMESTAMP.to_string());
fs::create_dir_all(&workdir).unwrap();