diff --git a/src/core/identity.rs b/src/core/identity.rs index 2ea8669..d60a6d5 100644 --- a/src/core/identity.rs +++ b/src/core/identity.rs @@ -558,33 +558,27 @@ impl IdentityManager { println!("Read lock on : Special_Roles_User"); // <-- after this is slightly different between working and problem let mut roleslock = roleslock.write().await; match (*roleslock).get(&usr.to_lowercase()) { - Some(usrroles) => { // <-- working got to this point - println!("contains mod : {}", usrroles.read().await.contains(&UserRole::Mod(channelname.clone()))); - println!("contains supmod : {}", usrroles.read().await.contains(&UserRole::SupMod(channelname.clone()))); - if usrroles.read().await.contains(&UserRole::Mod(channelname.clone())) || - usrroles.read().await.contains(&UserRole::SupMod(channelname.clone())) { + Some(usrroles) if + usrroles.read().await.contains(&UserRole::Mod(channelname.clone())) || + usrroles.read().await.contains(&UserRole::SupMod(channelname.clone())) => { // <-- working got to this point + // println!("contains mod : {}", usrroles.read().await.contains(&UserRole::Mod(channelname.clone()))); + // println!("contains supmod : {}", usrroles.read().await.contains(&UserRole::SupMod(channelname.clone()))); + // if usrroles.read().await.contains(&UserRole::Mod(channelname.clone())) || + // usrroles.read().await.contains(&UserRole::SupMod(channelname.clone())) { // Do nothing - this is expected println!("Already a mod in roles"); - } else { - // in this case, they have a ChatBadge::Mod but should have this for the channel - // let mut a = usrroles; - // usrroles.push(UserRole::Mod(channelname.clone())); - // a.push(UserRole::Mod(channelname.clone())); - println!("Was in the else loop"); - // let a = &*self; // let mut lock = a.special_roles_users.write().await; - println!("lock created > adding with a mod role o7"); - roleslock.get_mut(&usr.to_lowercase()) - // .expect("ERROR") - .unwrap() - .write().await - // .get_mut() - .push(UserRole::Mod(channelname.clone())); + // println!("lock created > adding with a mod role o7"); + // roleslock.get_mut(&usr.to_lowercase()) + // // .expect("ERROR") + // .unwrap() + // .write().await + // // .get_mut() + // .push(UserRole::Mod(channelname.clone())); // println!("debug special roles : {:?}",self.special_roles_users); - } - }, + } _ => { println!("lock created > adding with a mod role o7"); roleslock.get_mut(&usr.to_lowercase()) @@ -593,7 +587,7 @@ impl IdentityManager { .write().await // .get_mut() .push(UserRole::Mod(channelname.clone())); - }// <-- I'm assuming problem got to here + } // <-- I'm assuming problem got to here } },