Radish alpha
r
Radicle desktop app
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix contributor filter in list_repos & repo_count
✓ CI success Daniel Norman committed 8 days ago
commit 3fc73a0b8937cbc816aad2034a6a23fa5840ff52
parent 28e1ddd372e441f10e563c2f22cde11898d8e563
1 passed (1 total) View logs
1 file changed +12 -4
modified crates/radicle-types/src/traits/repo.rs
@@ -32,6 +32,16 @@ pub enum Show {
    Private,
}

+
/// A repo counts as one the local node contributes to whenever it has
+
/// local signed refs, even if those refs are at an outdated feature
+
/// level pending node-side migration.
+
fn is_contributor(refs: &storage::SignedRefsInfo) -> bool {
+
    matches!(
+
        refs,
+
        storage::SignedRefsInfo::Some(_) | storage::SignedRefsInfo::NeedsMigration,
+
    )
+
}
+

pub trait Repo: Profile {
    fn list_repos(&self, show: Show) -> Result<Vec<repo::RepoInfo>, Error> {
        let profile = self.profile();
@@ -41,9 +51,7 @@ pub trait Repo: Profile {
        let mut entries = Vec::new();

        for RepositoryInfo { rid, doc, refs, .. } in repos {
-
            if matches!(refs, radicle::storage::SignedRefsInfo::Some(_))
-
                && show == Show::Contributor
-
            {
+
            if !is_contributor(&refs) && show == Show::Contributor {
                continue;
            }

@@ -126,7 +134,7 @@ pub trait Repo: Profile {
                delegate += 1;
            }

-
            if matches!(refs, radicle::storage::SignedRefsInfo::Some(_)) {
+
            if is_contributor(&refs) {
                contributor += 1;
            }
        }