mirror of https://github.com/buster-so/buster.git
Refactor permission handling in get_message_with_permission function
- Updated the logic to determine final_permission by checking if permission is Some, simplifying the condition. - Improved error handling for non-public threads when no permissions are provided.
This commit is contained in:
parent
c77018abbd
commit
a7ae1b1dfd
|
@ -84,7 +84,9 @@ pub async fn get_message_with_permission(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let final_permission = if permission.is_none() && !is_public_thread {
|
let final_permission = if permission.is_some() {
|
||||||
|
permission.unwrap()
|
||||||
|
} else if !is_public_thread {
|
||||||
return Err(anyhow!("No message found with permissions"));
|
return Err(anyhow!("No message found with permissions"));
|
||||||
} else {
|
} else {
|
||||||
AssetPermissionRole::Viewer
|
AssetPermissionRole::Viewer
|
||||||
|
|
Loading…
Reference in New Issue