Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat: hardcode legacy_user_permissions has_trialed to be true (#1709)

Will Hutchinson9b4bbc1b26a7
diff --git a/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rs b/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rs
index cded46ddc5..c6ea29f35e 100644
--- a/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rs
+++ b/rust/cloud-storage/authentication_service/src/api/user/get_legacy_user_permissions.rs
@@ -1,5 +1,3 @@
-use std::str::FromStr;
-
use axum::{
Extension, Json,
extract::State,
@@ -56,8 +54,6 @@ impl IntoResponse for GetLegacyUserPermissionsResponse {
pub enum GetLegacyUserPermissionsError {
#[error("Internal error")]
InternalError(#[from] anyhow::Error),
- #[error("Stripe error")]
- StripeError,
#[error("Invalid macro user id")]
InvalidMacroUserId,
}
@@ -71,12 +67,6 @@ impl IntoResponse for GetLegacyUserPermissionsError {
message: "internal error",
}),
),
- GetLegacyUserPermissionsError::StripeError => (
- StatusCode::INTERNAL_SERVER_ERROR,
- Json(ErrorResponse {
- message: "stripe error",
- }),
- ),
GetLegacyUserPermissionsError::InvalidMacroUserId => (
StatusCode::BAD_REQUEST,
Json(ErrorResponse {
@@ -129,23 +119,6 @@ pub async fn handler(
"inactive"
};
- let has_trialed = if let Some(stripe_customer_id) = legacy_user_info.stripe_customer_id.as_ref()
- {
- let customer_id = stripe::CustomerId::from_str(stripe_customer_id)
- .map_err(|_| GetLegacyUserPermissionsError::StripeError)?;
- // Get the user's stripe metadata and check if they have trialed
- let customer = stripe::Customer::retrieve(&ctx.stripe_client, &customer_id, &[])
- .await
- .map_err(|_| GetLegacyUserPermissionsError::StripeError)?;
-
- customer
- .metadata
- .map(|m| m.contains_key("has_trialed"))
- .unwrap_or(false)
- } else {
- false
- };
-
Ok(GetLegacyUserPermissionsResponse {
user_id: user_id.as_ref().to_string(),
email: email.as_ref().to_string(),
@@ -159,7 +132,7 @@ pub async fn handler(
_ => None,
},
has_chrome_ext: legacy_user_info.has_chrome_ext,
- has_trialed,
+ has_trialed: true, // setting to true until we deprecate the usage on the frontend
ai_data_consent: legacy_user_info.ai_data_consent,
})
}
diff --git a/rust/cloud-storage/macro_db_client/src/user/get/get_legacy_user_info.rs b/rust/cloud-storage/macro_db_client/src/user/get/get_legacy_user_info.rs
index 9fab16b6bc..bb03340afa 100644
--- a/rust/cloud-storage/macro_db_client/src/user/get/get_legacy_user_info.rs
+++ b/rust/cloud-storage/macro_db_client/src/user/get/get_legacy_user_info.rs
@@ -12,6 +12,8 @@ pub struct LegacyUserInfo {
pub ai_data_consent: bool,
}
+/// Gets the legacy user info
+#[tracing::instrument(skip(db), err)]
pub async fn get_legacy_user_info(
db: &sqlx::Pool<sqlx::Postgres>,
user_id: &MacroUserId<Lowercase<'_>>,