Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
httpd: Use `commits`/`commit` instead of `headers`/`header`
xphoniex committed 3 years ago
commit 05da23b707bb529271510c7529a626188cf2d0c3
parent 24d19b69d23858e3e9aa85470379eac61bb6c80d
1 file changed +8 -8
modified radicle-httpd/src/api/v1/projects.rs
@@ -140,7 +140,7 @@ async fn history_handler(
        per_page.unwrap_or(30)
    };

-
    let headers = repo
+
    let commits = repo
        .history(&sha)?
        .filter(|q| {
            if let Ok(q) = q {
@@ -170,7 +170,7 @@ async fn history_handler(
                    .collect();
                let diff = repo.diff_commit(c.id)?;
                Ok(json!({
-
                    "header": api::json::commit(&c),
+
                    "commit": api::json::commit(&c),
                    "diff": diff,
                    "branches": branches
                }))
@@ -179,7 +179,7 @@ async fn history_handler(
        .collect::<Result<Vec<_>, _>>()?;

    let response = json!({
-
        "headers": headers,
+
        "commits": commits,
        "stats":  repo.stats()?,
    });

@@ -209,7 +209,7 @@ async fn commit_handler(
        .collect();

    let response = json!({
-
      "header": api::json::commit(&commit),
+
      "commit": api::json::commit(&commit),
      "diff": diff,
      "branches": branches
    });
@@ -521,9 +521,9 @@ mod routes {
        assert_eq!(
            response.json().await,
            json!({
-
              "headers": [
+
              "commits": [
                {
-
                  "header": {
+
                  "commit": {
                    "sha1": HEAD,
                    "author": {
                      "name": "Alice Liddell",
@@ -573,7 +573,7 @@ mod routes {
                  ]
                },
                {
-
                  "header": {
+
                  "commit": {
                    "sha1": HEAD_1,
                    "author": {
                      "name": "Alice Liddell",
@@ -647,7 +647,7 @@ mod routes {
        assert_eq!(
            response.json().await,
            json!({
-
              "header": {
+
              "commit": {
                "sha1": HEAD,
                "author": {
                  "name": "Alice Liddell",