From a1f5fe6e2af3a6f159083d52e4b3ffbbe6dd37c4 Mon Sep 17 00:00:00 2001 From: dal Date: Thu, 6 Mar 2025 16:52:14 -0700 Subject: [PATCH] last few changes --- api/src/routes/ws/collections/collection_utils.rs | 2 ++ api/src/routes/ws/dashboards/dashboard_utils.rs | 1 + api/src/routes/ws/threads_and_messages/messages_utils.rs | 1 + api/src/routes/ws/threads_and_messages/thread_utils.rs | 1 + api/src/routes/ws/users/favorites/favorites_utils.rs | 1 + api/src/utils/sharing/asset_sharing.rs | 9 +++++++++ 6 files changed, 15 insertions(+) diff --git a/api/src/routes/ws/collections/collection_utils.rs b/api/src/routes/ws/collections/collection_utils.rs index be01f559b..18c5be38d 100644 --- a/api/src/routes/ws/collections/collection_utils.rs +++ b/api/src/routes/ws/collections/collection_utils.rs @@ -256,6 +256,7 @@ pub async fn get_user_collection_permission( AssetPermissionRole::Owner => 3, AssetPermissionRole::Editor => 2, AssetPermissionRole::Viewer => 1, + _ => 0, }) .ok_or_else(|| anyhow!("No collection found with permissions"))?; @@ -376,6 +377,7 @@ async fn get_collection_and_check_permissions( AssetPermissionRole::Owner => 3, AssetPermissionRole::Editor => 2, AssetPermissionRole::Viewer => 1, + _ => 0, }) .ok_or_else(|| anyhow!("No collection found with permissions"))?; diff --git a/api/src/routes/ws/dashboards/dashboard_utils.rs b/api/src/routes/ws/dashboards/dashboard_utils.rs index 121de37f9..55f9451b8 100644 --- a/api/src/routes/ws/dashboards/dashboard_utils.rs +++ b/api/src/routes/ws/dashboards/dashboard_utils.rs @@ -283,6 +283,7 @@ pub async fn get_user_dashboard_permission( AssetPermissionRole::Owner => 3, AssetPermissionRole::Editor => 2, AssetPermissionRole::Viewer => 1, + _ => 0, }) .ok_or_else(|| anyhow!("No dashboard found with permissions"))?; diff --git a/api/src/routes/ws/threads_and_messages/messages_utils.rs b/api/src/routes/ws/threads_and_messages/messages_utils.rs index 4baa98053..651c5c914 100644 --- a/api/src/routes/ws/threads_and_messages/messages_utils.rs +++ b/api/src/routes/ws/threads_and_messages/messages_utils.rs @@ -221,6 +221,7 @@ pub async fn get_user_thread_permission( AssetPermissionRole::Owner => 3, AssetPermissionRole::Editor => 2, AssetPermissionRole::Viewer => 1, + _ => 0, }) .ok_or_else(|| anyhow!("No thread found with permissions"))?; diff --git a/api/src/routes/ws/threads_and_messages/thread_utils.rs b/api/src/routes/ws/threads_and_messages/thread_utils.rs index e99596078..2676a76ce 100644 --- a/api/src/routes/ws/threads_and_messages/thread_utils.rs +++ b/api/src/routes/ws/threads_and_messages/thread_utils.rs @@ -430,6 +430,7 @@ pub async fn get_user_thread_permission( AssetPermissionRole::Owner => 3, AssetPermissionRole::Editor => 2, AssetPermissionRole::Viewer => 1, + _ => 0, }) .ok_or_else(|| anyhow!("No thread found with permissions"))?; diff --git a/api/src/routes/ws/users/favorites/favorites_utils.rs b/api/src/routes/ws/users/favorites/favorites_utils.rs index a6bbc71ca..d24296787 100644 --- a/api/src/routes/ws/users/favorites/favorites_utils.rs +++ b/api/src/routes/ws/users/favorites/favorites_utils.rs @@ -158,6 +158,7 @@ pub async fn list_user_favorites(user: &AuthenticatedUser) -> Result {} } } diff --git a/api/src/utils/sharing/asset_sharing.rs b/api/src/utils/sharing/asset_sharing.rs index 9a7ac82d0..0c65f747a 100644 --- a/api/src/utils/sharing/asset_sharing.rs +++ b/api/src/utils/sharing/asset_sharing.rs @@ -614,6 +614,12 @@ fn create_invitation_email_type( thread_name: asset_name, thread_id: asset_id, }), + _ => EmailType::ThreadInvite(ThreadInvite { + inviter_name, + new_user, + thread_name: asset_name, + thread_id: asset_id, + }), }; email_type @@ -673,6 +679,9 @@ async fn get_asset_name(asset_id: Arc, asset_type: AssetType) -> Result { + return Err(anyhow!("Public access is not supported for chats yet")); + } }; Ok(name)