avoid promising referral rewards

This commit is contained in:
jayp-oai
2026-07-06 11:59:05 -07:00
parent f2eb0492e2
commit 5ca92fea3f
4 changed files with 4 additions and 30 deletions
+1 -27
View File
@@ -179,7 +179,7 @@ impl ReferralClient {
let description = eligibility
.description
.clone()
.unwrap_or_else(|| fallback_description(&eligibility));
.unwrap_or_else(|| "Invite someone to Codex. Rewards may apply.".to_string());
Ok(Some(ReferralOffer {
description,
@@ -317,29 +317,3 @@ fn preflight_failure(message: impl Into<String>) -> anyhow::Error {
}
.into()
}
fn fallback_description(eligibility: &EligibilityResponse) -> String {
match (&eligibility.grant_amount, &eligibility.grant_action) {
(Some(amount), Some(action)) => format!(
"Invite someone and earn {} {}.",
reward_value_to_string(amount),
reward_value_to_string(action)
),
(Some(amount), None) => format!(
"Invite someone and earn a Codex reward worth {}.",
reward_value_to_string(amount)
),
(None, Some(action)) => format!(
"Invite someone and earn a Codex {} reward.",
reward_value_to_string(action)
),
(None, None) => "Invite someone and earn a Codex reward.".to_string(),
}
}
fn reward_value_to_string(value: &Value) -> String {
value
.as_str()
.map(str::to_string)
.unwrap_or_else(|| value.to_string())
}
@@ -7,6 +7,6 @@ expression: "render_bottom_popup(&chat, 80)"
› 1. Show usage View recent account token usage.
2. Redeem usage limit reset Check reset availability.
3. Invite someone to Codex Invite a friend and earn a usage reset.
3. Invite someone to Codex Invite someone to Codex. Rewards may apply.
Press enter to confirm or esc to go back
@@ -173,7 +173,7 @@ async fn changed_referral_offer_requires_reconfirmation_before_send() {
fn test_offer() -> ReferralOffer {
ReferralOffer {
description: "Invite a friend and earn a usage reset.".to_string(),
description: "Invite someone to Codex. Rewards may apply.".to_string(),
rules: vec!["Your friend must be new to Codex.".to_string()],
grant_action: Some(serde_json::json!("usage_reset")),
grant_amount: Some(serde_json::json!(1)),
@@ -11,7 +11,7 @@ EMAIL
Press enter to confirm or esc to go back
CONFIRMATION
Send referral invite?
Invite a friend and earn a usage reset.
Invite someone to Codex. Rewards may apply.
Recipient: friend@example.com
• Your friend must be new to Codex.
By sending, you confirm that you have this