diff --git a/prdoc/1.6.0/pr_2883.prdoc b/prdoc/1.6.0/pr_2883.prdoc deleted file mode 100644 index e2817d16a03f..000000000000 --- a/prdoc/1.6.0/pr_2883.prdoc +++ /dev/null @@ -1,9 +0,0 @@ -title: "pallet-core-fellowship: import an unimported on approve" - -doc: - - audience: Runtime User - description: | - To align with the documentation of the approve call, we import an untracked member on approval. - -crates: - - name: "pallet-core-fellowship" diff --git a/substrate/frame/core-fellowship/src/lib.rs b/substrate/frame/core-fellowship/src/lib.rs index ee16ae07ce6e..a0a45c7c594d 100644 --- a/substrate/frame/core-fellowship/src/lib.rs +++ b/substrate/frame/core-fellowship/src/lib.rs @@ -362,8 +362,7 @@ pub mod pallet { /// /// This resets `last_proof` to the current block, thereby delaying any automatic demotion. /// - /// If `who` is not already tracked by this pallet, then it will become tracked. - /// `last_promotion` will be set to zero. + /// `who` must already be tracked by this pallet for this to have an effect. /// /// - `origin`: An origin which satisfies `ApproveOrigin` or root. /// - `who`: A member (i.e. of non-zero rank). @@ -382,11 +381,7 @@ pub mod pallet { ensure!(at_rank > 0, Error::::InvalidRank); let rank = T::Members::rank_of(&who).ok_or(Error::::Unranked)?; ensure!(rank == at_rank, Error::::UnexpectedRank); - let mut member = if let Some(m) = Member::::get(&who) { - m - } else { - Self::import_member(who.clone(), rank) - }; + let mut member = Member::::get(&who).ok_or(Error::::NotTracked)?; member.last_proof = frame_system::Pallet::::block_number(); Member::::insert(&who, &member); @@ -522,7 +517,13 @@ pub mod pallet { let who = ensure_signed(origin)?; ensure!(!Member::::contains_key(&who), Error::::AlreadyInducted); let rank = T::Members::rank_of(&who).ok_or(Error::::Unranked)?; - let _ = Self::import_member(who, rank); + + let now = frame_system::Pallet::::block_number(); + Member::::insert( + &who, + MemberStatus { is_active: true, last_promotion: 0u32.into(), last_proof: now }, + ); + Self::deposit_event(Event::::Imported { who, rank }); Ok(Pays::No.into()) } @@ -546,18 +547,6 @@ pub mod pallet { Self::deposit_event(e); } } - - fn import_member(who: T::AccountId, rank: RankOf) -> MemberStatusOf { - let now = frame_system::Pallet::::block_number(); - let status = MemberStatus { - is_active: true, - last_promotion: BlockNumberFor::::zero(), - last_proof: now, - }; - Member::::insert(&who, status.clone()); - Self::deposit_event(Event::::Imported { who, rank }); - status - } } impl, I: 'static> GetSalary, T::AccountId, T::Balance> for Pallet { diff --git a/substrate/frame/core-fellowship/src/tests.rs b/substrate/frame/core-fellowship/src/tests.rs index 6d9cebbf9219..c9098f2171f4 100644 --- a/substrate/frame/core-fellowship/src/tests.rs +++ b/substrate/frame/core-fellowship/src/tests.rs @@ -378,11 +378,3 @@ fn active_changing_get_salary_works() { } }); } - -#[test] -fn approve_imports_not_tracked_member() { - new_test_ext().execute_with(|| { - set_rank(10, 5); - assert_ok!(CoreFellowship::approve(signed(5), 10, 5)); - }); -}