reorg can_user_run inner code

This commit is contained in:
ModulatingForce 2024-02-12 15:32:53 -05:00
parent f8cd4d959c
commit 2512655aab

View file

@ -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
}
},