aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-01-17 08:33:25 -0600
committerNathan Ringo <nathan@remexre.com>2024-01-17 08:33:25 -0600
commit59accae1e5b6848592b0beaa6f0e6c481288d357 (patch)
treeac286b396d0d4df7efbdeba1c080b2a67301c491 /src
parent916af135916f72b6d09f80d32ae1081e25aa5bdb (diff)
Don't try to re-add a role the user already has.
Diffstat (limited to 'src')
-rw-r--r--src/handlers/x500_mapper.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/handlers/x500_mapper.rs b/src/handlers/x500_mapper.rs
index 36ce386..1ec35f2 100644
--- a/src/handlers/x500_mapper.rs
+++ b/src/handlers/x500_mapper.rs
@@ -113,10 +113,12 @@ impl X500Mapper {
if let Some(role) = self.config.students_role {
log::info!("adding the role {} to {}", role, member.display_name());
- member
- .add_role(&ctx.http, role)
- .await
- .context("failed to add student role")?
+ if !member.roles.contains(&role) {
+ member
+ .add_role(&ctx.http, role)
+ .await
+ .context("failed to add student role")?
+ }
}
Ok::<_, anyhow::Error>(())