Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
cob: Changes to patch code review CRDT
Alexis Sellier committed 2 years ago
commit 622b2735f3d31143375db8e4b67eca8bb95ee3bd
parent bbe0ee26b3eeb48e223261c4d8a4ffb249e2f500
2 files changed +19 -34
modified radicle-httpd/src/api/json.rs
@@ -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(),
        }),
    }
modified radicle-httpd/src/api/v1/projects.rs
@@ -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,
                    },
                  ],