Skip to content

Commit

Permalink
check for no role before remove outdated BM
Browse files Browse the repository at this point in the history
  • Loading branch information
alyn509 committed Mar 16, 2024
1 parent 319c2c8 commit 6444205
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contracts/multisig/src/multisig_sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,16 @@ pub trait MultisigSignModule:
let mut board_members_to_remove: ManagedVec<usize> = ManagedVec::new();
if outdated_board_members.is_empty() {
for signer_id in self.action_signer_ids(action_id).iter() {
if !self.user_id_to_role(signer_id).get().can_sign() {
if self.user_id_to_role(signer_id).get().has_no_role() {
board_members_to_remove.push(signer_id);
}
}
} else {
board_members_to_remove = outdated_board_members.to_vec();
for signer_id in outdated_board_members.into_iter() {
if self.user_id_to_role(signer_id).get().has_no_role() {
board_members_to_remove.push(signer_id);
}
}
}
for member in board_members_to_remove.iter() {
self.action_signer_ids(action_id).swap_remove(&member);
Expand Down
4 changes: 4 additions & 0 deletions contracts/multisig/src/user_role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ impl UserRole {
pub fn can_sign(&self) -> bool {
matches!(*self, UserRole::BoardMember)
}

pub fn has_no_role(&self) -> bool {
matches!(*self, UserRole::None)
}
}

0 comments on commit 6444205

Please sign in to comment.