From 5902236d0a4b2ee92058ffc7f4294d5fa526eb5d Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Mon, 6 Mar 2023 10:16:06 +0000 Subject: [PATCH] radicle: remove DelegatesOnly scope The DelegatesOnly scope is very limited and causes more confusion than it solves. The Trusted scope subsumes DelegatesOnly since it implies delegates along with any tracked nodes. This feels more natural to use and so DelegatesOnly is removed -- leaving only Trusted and All. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-node/src/service/tracking/store.rs | 4 ++-- radicle/src/node/tracking.rs | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/radicle-node/src/service/tracking/store.rs b/radicle-node/src/service/tracking/store.rs index 18cd5353..e25cca81 100644 --- a/radicle-node/src/service/tracking/store.rs +++ b/radicle-node/src/service/tracking/store.rs @@ -309,8 +309,8 @@ mod test { assert!(db.track_repo(&id, Scope::All).unwrap()); assert_eq!(db.repo_entry(&id).unwrap().unwrap().0, Scope::All); - assert!(db.track_repo(&id, Scope::DelegatesOnly).unwrap()); - assert_eq!(db.repo_entry(&id).unwrap().unwrap().0, Scope::DelegatesOnly); + assert!(db.track_repo(&id, Scope::Trusted).unwrap()); + assert_eq!(db.repo_entry(&id).unwrap().unwrap().0, Scope::Trusted); } #[test] diff --git a/radicle/src/node/tracking.rs b/radicle/src/node/tracking.rs index 57380059..df568107 100644 --- a/radicle/src/node/tracking.rs +++ b/radicle/src/node/tracking.rs @@ -94,8 +94,6 @@ impl TryFrom<&sqlite::Value> for Policy { pub enum Scope { /// Track remotes of nodes that are already tracked. Trusted, - /// Track remotes of repository delegates. - DelegatesOnly, /// Track all remotes. All, } @@ -104,7 +102,6 @@ impl fmt::Display for Scope { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Scope::Trusted => f.write_str("trusted"), - Scope::DelegatesOnly => f.write_str("delegates-only"), Scope::All => f.write_str("all"), } } @@ -120,7 +117,6 @@ impl FromStr for Scope { fn from_str(s: &str) -> Result { match s { "trusted" => Ok(Self::Trusted), - "delegates-only" => Ok(Self::DelegatesOnly), "all" => Ok(Self::All), _ => Err(ParseScopeError(s.to_string())), } @@ -136,7 +132,6 @@ impl sqlite::BindableWithIndex for Scope { ) -> sqlite::Result<()> { let s = match self { Self::Trusted => "trusted", - Self::DelegatesOnly => "delegates-only", Self::All => "all", }; s.bind(stmt, i)