Browse Source

credential checker: dont use unstable map_or

Mokhtar Naamani 5 years ago
parent
commit
f41ec8276f
2 changed files with 6 additions and 4 deletions
  1. 2 2
      src/content_working_group/lib.rs
  2. 4 2
      src/lib.rs

+ 2 - 2
src/content_working_group/lib.rs

@@ -1462,7 +1462,7 @@ decl_module! {
         pub fn fill_curator_opening(
             origin,
             curator_opening_id: CuratorOpeningId<T>,
-            successful_curator_application_ids: CuratorApplicationIdSet<T>, 
+            successful_curator_application_ids: CuratorApplicationIdSet<T>,
         ) {
             // Ensure lead is set and is origin signer
             let (lead_id, _lead) = Self::ensure_origin_is_set_lead(origin)?;
@@ -2116,7 +2116,7 @@ impl<T: Trait> Module<T> {
         }
     }
 
-    fn ensure_lead_is_set() -> Result<
+    pub fn ensure_lead_is_set() -> Result<
         (
             LeadId<T>,
             Lead<T::AccountId, T::RewardRelationshipId, T::BlockNumber>,

+ 4 - 2
src/lib.rs

@@ -450,8 +450,10 @@ impl versioned_store_permissions::CredentialChecker<Runtime> for ContentWorkingG
         match credential {
             // Credentials from 0..999 represents groups or more complex requirements
             // Current Lead if set
-            0 => <content_wg::Module<Runtime>>::ensure_lead_is_set()
-                .map_or(false, |(_, lead)| lead.role_account == *account),
+            0 => match <content_wg::Module<Runtime>>::ensure_lead_is_set() {
+                Ok((_, lead)) => lead.role_account == *account,
+                _ => false,
+            },
             // Any Active Curator
             1 => {
                 // Look for a Curator with a matching role account