Skip to content

Commit

Permalink
fix invitation
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Mar 5, 2020
1 parent 2eb8e31 commit d36dce3
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/rules/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,9 @@ pub fn user_not_a_member(ctx: &RuleContext) -> Result<(), RuleError> {
let member_uuid = ctx.member_uuid.ok_or(RuleError::InvalidRuleContext)?;
let connection = ctx.pool.get().map_err(|_| RuleError::PoolError)?;
match internal::member::role_for(&connection, member_uuid, ctx.group) {
Ok(_) => Err(RuleError::AlreadyMember),
Err(e) => {
if let Some(DieselError::NotFound) = e.downcast_ref::<DieselError>() {
Ok(())
} else {
Err(RuleError::DBError)
}
}
Ok(Some(_)) => Err(RuleError::AlreadyMember),
Ok(None) => Ok(()),
Err(_) => Err(RuleError::DBError),
}
}

Expand Down

0 comments on commit d36dce3

Please sign in to comment.