diff --git a/common/src/database/mod.rs b/common/src/database/mod.rs index 26a340c..6a81afe 100644 --- a/common/src/database/mod.rs +++ b/common/src/database/mod.rs @@ -231,7 +231,7 @@ pub mod tests { PrincsFilterOperation::Only ); assert_eq!( - tata.princs_filter().princs(), + tata.princs_filter().princ_literals(), &HashSet::from(["couscous".to_string(), "boulette".to_string()]) ); @@ -297,7 +297,7 @@ pub mod tests { PrincsFilterOperation::Only ); assert_eq!( - tata2.princs_filter().princs(), + tata2.princs_filter().princ_literals(), &HashSet::from([ "couscous".to_string(), "boulette".to_string(), @@ -328,7 +328,7 @@ pub mod tests { PrincsFilterOperation::Except ); assert_eq!( - tata2_clone.princs_filter().princs(), + tata2_clone.princs_filter().princ_literals(), &HashSet::from(["boulette".to_string(), "semoule".to_string()]) ); @@ -347,7 +347,7 @@ pub mod tests { .await? .unwrap(); assert_eq!(tata2_clone_clone.princs_filter().operation(), None); - assert_eq!(tata2_clone_clone.princs_filter().princs(), &HashSet::new()); + assert_eq!(tata2_clone_clone.princs_filter().princ_literals(), &HashSet::new()); assert_eq!(tata2_clone_clone.is_active_for("couscous"), true); assert_eq!(tata2_clone_clone.is_active_for("semoule"), true); assert_eq!(tata2_clone_clone.is_active_for("boulette"), true); diff --git a/common/src/models/export.rs b/common/src/models/export.rs index d466448..f6605c7 100644 --- a/common/src/models/export.rs +++ b/common/src/models/export.rs @@ -549,7 +549,7 @@ pub mod v2 { fn from(value: crate::subscription::PrincsFilter) -> Self { Self { operation: value.operation().map(|x| x.clone().into()), - princs: value.princs().clone(), + princs: value.princ_literals().clone(), } } } diff --git a/common/src/subscription.rs b/common/src/subscription.rs index 81d00ad..d93296e 100644 --- a/common/src/subscription.rs +++ b/common/src/subscription.rs @@ -265,12 +265,12 @@ impl PrincsFilter { }) } - pub fn princs(&self) -> &HashSet { + pub fn princ_literals(&self) -> &HashSet { &self.princs } pub fn princs_to_string(&self) -> String { - self.princs() + self.princs .iter() .cloned() .collect::>() @@ -278,7 +278,7 @@ impl PrincsFilter { } pub fn princs_to_opt_string(&self) -> Option { - if self.princs().is_empty() { + if self.princs.is_empty() { None } else { Some(self.princs_to_string()) @@ -813,9 +813,9 @@ impl SubscriptionData { match self.princs_filter().operation { None => true, - Some(PrincsFilterOperation::Only) => self.princs_filter().princs().contains(principal), + Some(PrincsFilterOperation::Only) => self.princs_filter().princ_literals().contains(principal), Some(PrincsFilterOperation::Except) => { - !self.princs_filter().princs().contains(principal) + !self.princs_filter().princ_literals().contains(principal) } } }