Browse Source

membership: use consistent naming for metadata

conectado 4 years ago
parent
commit
d648585069

+ 1 - 1
runtime-modules/blog/src/benchmarking.rs

@@ -44,7 +44,7 @@ fn member_funded_account<T: Trait<I> + membership::Trait + balances::Trait, I: I
         root_account: account_id.clone(),
         controller_account: account_id.clone(),
         handle: Some(handle),
-        meta_data: Vec::new(),
+        metadata: Vec::new(),
         referrer_id: None,
     };
 

+ 1 - 1
runtime-modules/council/src/benchmarking.rs

@@ -151,7 +151,7 @@ where
         root_account: account_id.clone(),
         controller_account: account_id.clone(),
         handle: Some(handle),
-        meta_data: Vec::new(),
+        metadata: Vec::new(),
         referrer_id: None,
     };
 

+ 1 - 1
runtime-modules/forum/src/benchmarking.rs

@@ -77,7 +77,7 @@ where
         root_account: account_id.clone(),
         controller_account: account_id.clone(),
         handle: Some(handle),
-        meta_data: Vec::new(),
+        metadata: Vec::new(),
         referrer_id: None,
     };
 

+ 8 - 8
runtime-modules/membership/src/benchmarking.rs

@@ -53,7 +53,7 @@ fn member_funded_account<T: Trait + balances::Trait>(
         root_account: account_id.clone(),
         controller_account: account_id.clone(),
         handle: Some(handle),
-        meta_data: Vec::new(),
+        metadata: Vec::new(),
         referrer_id: None,
     };
 
@@ -107,14 +107,14 @@ benchmarks! {
 
         let fee = Module::<T>::membership_price();
 
-        let meta_data = vec![0u8].repeat(j as usize);
+        let metadata = vec![0u8].repeat(j as usize);
 
         let params = BuyMembershipParameters {
             root_account: account_id.clone(),
             controller_account: account_id.clone(),
             handle: Some(handle.clone()),
             referrer_id: None,
-            meta_data,
+            metadata,
         };
 
     }: buy_membership(RawOrigin::Signed(account_id.clone()), params.clone())
@@ -157,7 +157,7 @@ benchmarks! {
 
         let _ = Balances::<T>::make_free_balance_be(&account_id, BalanceOf::<T>::max_value());
 
-        let meta_data = vec![0u8].repeat(j as usize);
+        let metadata = vec![0u8].repeat(j as usize);
 
         let fee = Module::<T>::membership_price();
 
@@ -165,7 +165,7 @@ benchmarks! {
             root_account: account_id.clone(),
             controller_account: account_id.clone(),
             handle: Some(handle.clone()),
-            meta_data,
+            metadata,
             referrer_id: None,
         };
 
@@ -231,7 +231,7 @@ benchmarks! {
             root_account: account_id.clone(),
             controller_account: account_id.clone(),
             handle: Some(handle.clone()),
-            meta_data: Vec::new(),
+            metadata: Vec::new(),
             referrer_id: None,
         };
 
@@ -448,14 +448,14 @@ benchmarks! {
 
         let handle = handle_from_id::<T>(i);
 
-        let meta_data = vec![0u8].repeat(j as usize);
+        let metadata = vec![0u8].repeat(j as usize);
 
         let invite_params = InviteMembershipParameters {
             inviting_member_id: member_id,
             root_account: account_id.clone(),
             controller_account: account_id.clone(),
             handle: Some(handle.clone()),
-            meta_data,
+            metadata,
         };
 
         let default_invitation_balance = T::DefaultInitialInvitationBalance::get();

+ 10 - 10
runtime-modules/membership/src/lib.rs

@@ -173,8 +173,8 @@ pub struct BuyMembershipParameters<AccountId, MemberId> {
     /// New member handle.
     pub handle: Option<Vec<u8>>,
 
-    /// Meta data concerning new member.
-    pub meta_data: Vec<u8>,
+    /// Metadata concerning new member.
+    pub metadata: Vec<u8>,
 
     /// Referrer member id.
     pub referrer_id: Option<MemberId>,
@@ -195,8 +195,8 @@ pub struct InviteMembershipParameters<AccountId, MemberId> {
     /// New member handle.
     pub handle: Option<Vec<u8>>,
 
-    /// Meta data concerning new member.
-    pub meta_data: Vec<u8>,
+    /// Metadata concerning new member.
+    pub metadata: Vec<u8>,
 }
 
 decl_error! {
@@ -438,10 +438,10 @@ decl_module! {
             origin,
             member_id: T::MemberId,
             handle: Option<Vec<u8>>,
-            meta: Option<Vec<u8>>,
+            metadata: Option<Vec<u8>>,
         ) {
             // No effect if no changes.
-            if handle.is_none() && meta.is_none() {
+            if handle.is_none() && metadata.is_none() {
                 return Ok(())
             }
 
@@ -470,7 +470,7 @@ decl_module! {
                 Self::deposit_event(RawEvent::MemberProfileUpdated(
                         member_id,
                         handle,
-                        meta,
+                        metadata,
                     ));
             }
         }
@@ -641,7 +641,7 @@ decl_module! {
         // TODO: adjust weight
         #[weight = WeightInfoMembership::<T>::invite_member(
             Module::<T>::text_length_unwrap_or_default(&params.handle),
-            params.meta_data.len().saturated_into(),
+            params.metadata.len().saturated_into(),
         )]
         pub fn invite_member(
             origin,
@@ -930,12 +930,12 @@ impl<T: Trait> Module<T> {
         if params.referrer_id.is_some() {
             WeightInfoMembership::<T>::buy_membership_with_referrer(
                 Self::text_length_unwrap_or_default(&params.handle),
-                params.meta_data.len().saturated_into(),
+                params.metadata.len().saturated_into(),
             )
         } else {
             WeightInfoMembership::<T>::buy_membership_without_referrer(
                 Self::text_length_unwrap_or_default(&params.handle),
-                params.meta_data.len().saturated_into(),
+                params.metadata.len().saturated_into(),
             )
         }
     }

+ 12 - 12
runtime-modules/membership/src/tests/fixtures.rs

@@ -54,7 +54,7 @@ pub fn assert_dispatch_error_message(result: DispatchResult, expected_result: Di
 pub struct TestUserInfo {
     pub handle: Option<Vec<u8>>,
     pub handle_hash: Option<Vec<u8>>,
-    pub meta_data: Vec<u8>,
+    pub metadata: Vec<u8>,
 }
 
 pub fn get_alice_info() -> TestUserInfo {
@@ -62,7 +62,7 @@ pub fn get_alice_info() -> TestUserInfo {
     let hashed = <Test as frame_system::Trait>::Hashing::hash(&handle);
     let hash = hashed.as_ref().to_vec();
 
-    let meta_data = b"
+    let metadata = b"
     {
         'name': 'Alice',
         'avatar_uri': 'http://avatar-url.com/alice',
@@ -74,7 +74,7 @@ pub fn get_alice_info() -> TestUserInfo {
     TestUserInfo {
         handle: Some(handle),
         handle_hash: Some(hash),
-        meta_data,
+        metadata,
     }
 }
 
@@ -83,7 +83,7 @@ pub fn get_bob_info() -> TestUserInfo {
     let hashed = <Test as frame_system::Trait>::Hashing::hash(&handle);
     let hash = hashed.as_ref().to_vec();
 
-    let meta_data = b"
+    let metadata = b"
     {
         'name': 'Bob',
         'avatar_uri': 'http://avatar-url.com/bob',
@@ -95,7 +95,7 @@ pub fn get_bob_info() -> TestUserInfo {
     TestUserInfo {
         handle: Some(handle),
         handle_hash: Some(hash),
-        meta_data,
+        metadata,
     }
 }
 
@@ -112,7 +112,7 @@ pub fn get_alice_membership_parameters() -> BuyMembershipParameters<u64, u64> {
         controller_account: ALICE_ACCOUNT_ID,
         handle: info.handle,
         referrer_id: None,
-        meta_data: info.meta_data,
+        metadata: info.metadata,
     }
 }
 
@@ -178,7 +178,7 @@ pub struct BuyMembershipFixture {
     pub root_account: u64,
     pub controller_account: u64,
     pub handle: Option<Vec<u8>>,
-    pub meta_data: Vec<u8>,
+    pub metadata: Vec<u8>,
     pub referrer_id: Option<u64>,
 }
 
@@ -190,7 +190,7 @@ impl Default for BuyMembershipFixture {
             root_account: ALICE_ACCOUNT_ID,
             controller_account: ALICE_ACCOUNT_ID,
             handle: alice.handle,
-            meta_data: alice.meta_data,
+            metadata: alice.metadata,
             referrer_id: None,
         }
     }
@@ -202,7 +202,7 @@ impl BuyMembershipFixture {
             root_account: self.root_account.clone(),
             controller_account: self.controller_account.clone(),
             handle: self.handle.clone(),
-            meta_data: self.meta_data.clone(),
+            metadata: self.metadata.clone(),
             referrer_id: self.referrer_id.clone(),
         };
 
@@ -337,7 +337,7 @@ pub struct InviteMembershipFixture {
     pub root_account: u64,
     pub controller_account: u64,
     pub handle: Option<Vec<u8>>,
-    pub meta_data: Vec<u8>,
+    pub metadata: Vec<u8>,
 }
 
 impl Default for InviteMembershipFixture {
@@ -349,7 +349,7 @@ impl Default for InviteMembershipFixture {
             root_account: BOB_ACCOUNT_ID,
             controller_account: BOB_ACCOUNT_ID,
             handle: bob.handle,
-            meta_data: bob.meta_data,
+            metadata: bob.metadata,
         }
     }
 }
@@ -361,7 +361,7 @@ impl InviteMembershipFixture {
             root_account: self.root_account.clone(),
             controller_account: self.controller_account.clone(),
             handle: self.handle.clone(),
-            meta_data: self.meta_data.clone(),
+            metadata: self.metadata.clone(),
         }
     }
 

+ 2 - 2
runtime-modules/membership/src/tests/mod.rs

@@ -108,7 +108,7 @@ fn update_profile_succeeds() {
             Origin::signed(ALICE_ACCOUNT_ID),
             next_member_id,
             info.handle.clone(),
-            Some(info.meta_data.clone()),
+            Some(info.metadata.clone()),
         ));
 
         let profile = get_membership_by_id(next_member_id);
@@ -122,7 +122,7 @@ fn update_profile_succeeds() {
         EventFixture::assert_last_crate_event(Event::<Test>::MemberProfileUpdated(
             next_member_id,
             info.handle,
-            Some(info.meta_data),
+            Some(info.metadata),
         ));
     });
 }

+ 1 - 1
runtime-modules/proposals/codex/src/benchmarking.rs

@@ -61,7 +61,7 @@ fn member_funded_account<T: Trait + membership::Trait>(
         root_account: account_id.clone(),
         controller_account: account_id.clone(),
         handle: Some(handle),
-        meta_data: Vec::new(),
+        metadata: Vec::new(),
         referrer_id: None,
     };
 

+ 1 - 1
runtime-modules/proposals/discussion/src/benchmarking.rs

@@ -89,7 +89,7 @@ fn member_account<T: common::Trait + balances::Trait + membership::Trait>(
         root_account: account_id.clone(),
         controller_account: account_id.clone(),
         handle: Some(handle),
-        meta_data: Vec::new(),
+        metadata: Vec::new(),
         referrer_id: None,
     };
 

+ 1 - 1
runtime-modules/proposals/engine/src/benchmarking.rs

@@ -87,7 +87,7 @@ fn member_funded_account<T: Trait + membership::Trait>(
         root_account: account_id.clone(),
         controller_account: account_id.clone(),
         handle: Some(handle),
-        meta_data: Vec::new(),
+        metadata: Vec::new(),
         referrer_id: None,
     };
 

+ 1 - 1
runtime-modules/referendum/src/benchmarking.rs

@@ -221,7 +221,7 @@ fn member_funded_account<T: Trait<I> + membership::Trait, I: Instance>(
         root_account: account_id.clone(),
         controller_account: account_id.clone(),
         handle: Some(handle),
-        meta_data: Vec::new(),
+        metadata: Vec::new(),
         referrer_id: None,
     };
 

+ 1 - 1
runtime-modules/working-group/src/benchmarking.rs

@@ -165,7 +165,7 @@ fn member_funded_account<T: Trait<I> + membership::Trait, I: Instance>(
         root_account: account_id.clone(),
         controller_account: account_id.clone(),
         handle: Some(handle),
-        meta_data: Vec::new(),
+        metadata: Vec::new(),
         referrer_id: None,
     };
 

+ 1 - 1
runtime/src/tests/mod.rs

@@ -165,7 +165,7 @@ pub(crate) fn insert_member(account_id: AccountId32) {
         root_account: account_id.clone(),
         controller_account: account_id.clone(),
         handle: Some(handle.to_vec()),
-        meta_data: Vec::new(),
+        metadata: Vec::new(),
         referrer_id: None,
     };