mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-04 03:00:32 +08:00
cob: Changes to patch code review CRDT
This patch incorporates several important changes to code review: * Code review verdict is no longer editable * Made reviews redactable instead * Renamed review top-level comment to "summary" * Renamed inline comments to "comments" * Made inline comments addressable by `EntryId` * This is to allow for editing * Removed inline comments from review creation * Added a `CodeComment` action instead * Removed `Semilattice` instance from `Review` * Added a `EditReview` action instead to have more control * Made it valid for revisions to be redacted concurrently with a review/merge Most of these changes are needed to support proper inline code comments.
This commit is contained in:
@@ -188,8 +188,8 @@ fn review(nid: &NodeId, alias: Option<String>, review: &Review) -> Value {
|
||||
"alias": alias,
|
||||
},
|
||||
"verdict": review.verdict(),
|
||||
"comment": review.comment(),
|
||||
"inline": review.inline().collect::<Vec<_>>(),
|
||||
"summary": review.summary(),
|
||||
"comments": review.comments().collect::<Vec<_>>(),
|
||||
"timestamp": review.timestamp(),
|
||||
}),
|
||||
None => json!({
|
||||
@@ -197,8 +197,8 @@ fn review(nid: &NodeId, alias: Option<String>, review: &Review) -> Value {
|
||||
"id": nid,
|
||||
},
|
||||
"verdict": review.verdict(),
|
||||
"comment": review.comment(),
|
||||
"inline": review.inline().collect::<Vec<_>>(),
|
||||
"summary": review.summary(),
|
||||
"comments": review.comments().collect::<Vec<_>>(),
|
||||
"timestamp": review.timestamp(),
|
||||
}),
|
||||
}
|
||||
|
||||
@@ -644,6 +644,13 @@ async fn patch_update_handler(
|
||||
} => {
|
||||
patch.edit_revision(revision, description, &signer)?;
|
||||
}
|
||||
patch::Action::EditReview {
|
||||
revision,
|
||||
author,
|
||||
summary,
|
||||
} => {
|
||||
patch.edit_review(revision, author, summary, &signer)?;
|
||||
}
|
||||
patch::Action::Tag { add, remove } => {
|
||||
patch.tag(add, remove, &signer)?;
|
||||
}
|
||||
@@ -662,11 +669,13 @@ async fn patch_update_handler(
|
||||
}
|
||||
patch::Action::Review {
|
||||
revision,
|
||||
comment,
|
||||
summary,
|
||||
verdict,
|
||||
inline,
|
||||
} => {
|
||||
patch.review(revision, verdict, comment, inline, &signer)?;
|
||||
patch.review(revision, verdict, summary, &signer)?;
|
||||
}
|
||||
patch::Action::CodeComment { .. } => {
|
||||
todo!()
|
||||
}
|
||||
patch::Action::Merge { revision, commit } => {
|
||||
patch.merge(revision, commit, &signer)?;
|
||||
@@ -2237,23 +2246,8 @@ mod routes {
|
||||
let thread_body = serde_json::to_vec(&json!({
|
||||
"type": "review",
|
||||
"revision": CONTRIBUTOR_PATCH_ID,
|
||||
"comment": "A small review",
|
||||
"summary": "A small review",
|
||||
"verdict": "accept",
|
||||
"inline": [
|
||||
{
|
||||
"location": {
|
||||
"blob": "82eb77880c693655bce074e3dbbd9fa711dc018b",
|
||||
"path": "./README.md",
|
||||
"commit": HEAD,
|
||||
"lines": {
|
||||
"start": 1,
|
||||
"end": 3,
|
||||
},
|
||||
},
|
||||
"comment": "This is a comment on line 1",
|
||||
"timestamp": TIMESTAMP,
|
||||
}
|
||||
]
|
||||
}))
|
||||
.unwrap();
|
||||
let response = patch(
|
||||
@@ -2305,17 +2299,8 @@ mod routes {
|
||||
"id": CONTRIBUTOR_NID,
|
||||
},
|
||||
"verdict": "accept",
|
||||
"comment": "A small review",
|
||||
"inline": [
|
||||
{
|
||||
"location": {
|
||||
"path": "./README.md",
|
||||
"old": null,
|
||||
"new": null,
|
||||
},
|
||||
"comment": "This is a comment on line 1",
|
||||
}
|
||||
],
|
||||
"summary": "A small review",
|
||||
"comments": [],
|
||||
"timestamp": TIMESTAMP,
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user