Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle: Rename many more methods using new naming
cloudhead committed 2 years ago
commit 4816a4de5ff1c9cf9fe4ec7ab408ec7bac545db7
parent 8319fde08f8fa589dfa089241173b781e1288ec5
5 files changed +20 -20
modified radicle-httpd/src/api.rs
@@ -64,7 +64,7 @@ impl Context {
        let issues = issue::Issues::open(&repo)?.counts()?;
        let patches = patch::Patches::open(&repo)?.counts()?;
        let db = &self.profile.database()?;
-
        let trackings = db.count(&id).unwrap_or_default();
+
        let seeding = db.count(&id).unwrap_or_default();

        Ok(project::Info {
            payload,
@@ -74,7 +74,7 @@ impl Context {
            issues,
            patches,
            id,
-
            trackings,
+
            seeding,
        })
    }

@@ -213,7 +213,7 @@ mod project {
        pub patches: cob::patch::PatchCounts,
        pub issues: cob::issue::IssueCounts,
        pub id: Id,
-
        pub trackings: usize,
+
        pub seeding: usize,
    }
}

modified radicle-httpd/src/api/v1/delegates.rs
@@ -78,7 +78,7 @@ async fn delegates_projects_handler(
            };

            let delegates = id.doc.delegates;
-
            let trackings = db.count(&id.rid).unwrap_or_default();
+
            let seeding = db.count(&id.rid).unwrap_or_default();

            Some(Info {
                payload,
@@ -88,7 +88,7 @@ async fn delegates_projects_handler(
                issues,
                patches,
                id: id.rid,
-
                trackings,
+
                seeding,
            })
        })
        .skip(page * per_page)
@@ -146,7 +146,7 @@ mod routes {
                  "closed": 0,
                },
                "id": "rad:zLuTzcmoWMcdK37xqArS8eckp9vK",
-
                "trackings": 0,
+
                "seeding": 0,
              },
              {
                "name": "hello-world",
@@ -168,7 +168,7 @@ mod routes {
                  "closed": 0,
                },
                "id": RID,
-
                "trackings": 0,
+
                "seeding": 0,
              },
            ])
        );
@@ -207,7 +207,7 @@ mod routes {
                  "closed": 0,
                },
                "id": RID,
-
                "trackings": 0,
+
                "seeding": 0,
              }
            ])
        );
modified radicle-httpd/src/api/v1/node.rs
@@ -51,13 +51,13 @@ async fn node_handler(State(ctx): State<Context>) -> impl IntoResponse {
    Ok::<_, Error>(Json(response))
}

-
/// Return local tracking repos information.
+
/// Return local repo policies information.
/// `GET /node/policies/repos`
async fn node_policies_repos_handler(State(ctx): State<Context>) -> impl IntoResponse {
-
    let tracking = ctx.profile.tracking()?;
+
    let policies = ctx.profile.policies()?;
    let mut repos = Vec::new();

-
    for policy::Repo { id, scope, policy } in tracking.repo_policies()? {
+
    for policy::Repo { id, scope, policy } in policies.seed_policies()? {
        repos.push(json!({
            "id": id,
            "scope": scope,
@@ -68,7 +68,7 @@ async fn node_policies_repos_handler(State(ctx): State<Context>) -> impl IntoRes
    Ok::<_, Error>(Json(repos))
}

-
/// Track a new repo.
+
/// Seed a new repo.
/// `PUT /node/policies/repos/:rid`
async fn node_policies_seed_handler(
    State(ctx): State<Context>,
@@ -90,7 +90,7 @@ async fn node_policies_seed_handler(
    Ok::<_, Error>((StatusCode::OK, Json(json!({ "success": true }))))
}

-
/// Untrack a repo.
+
/// Unseed a repo.
/// `DELETE /node/policies/repos/:rid`
async fn node_policies_unseed_handler(
    State(ctx): State<Context>,
modified radicle-httpd/src/api/v1/projects.rs
@@ -119,7 +119,7 @@ async fn project_root_handler(
                return None;
            };
            let delegates = id.doc.delegates;
-
            let trackings = db.count(&id.rid).unwrap_or_default();
+
            let seeding = db.count(&id.rid).unwrap_or_default();

            Some(Info {
                payload,
@@ -129,7 +129,7 @@ async fn project_root_handler(
                issues,
                patches,
                id: id.rid,
-
                trackings,
+
                seeding,
            })
        })
        .skip(page * per_page)
@@ -994,7 +994,7 @@ mod routes {
                  "closed": 0,
                },
                "id": "rad:zLuTzcmoWMcdK37xqArS8eckp9vK",
-
                "trackings": 0,
+
                "seeding": 0,
              },
              {
                "name": "hello-world",
@@ -1016,7 +1016,7 @@ mod routes {
                  "closed": 0,
                },
                "id": RID,
-
                "trackings": 0,
+
                "seeding": 0,
              },
            ])
        );
@@ -1051,7 +1051,7 @@ mod routes {
                  "closed": 0,
                },
                "id": RID,
-
                "trackings": 0,
+
                "seeding": 0,
              }
            ])
        );
@@ -1086,7 +1086,7 @@ mod routes {
                 "closed": 0,
               },
               "id": RID,
-
               "trackings": 0,
+
               "seeding": 0,
            })
        );
    }
modified radicle-httpd/src/test.rs
@@ -96,7 +96,7 @@ fn seed_with_signer<G: Signer>(dir: &Path, profile: radicle::Profile, signer: &G

    crate::logger::init().ok();

-
    profile.tracking_mut().unwrap();
+
    profile.policies_mut().unwrap();
    profile.database_mut().unwrap(); // Create the database.

    let workdir = dir.join("hello-world-private");