huskies: merge 726_story_notify_chat_transports_when_oauth_account_swaps_or_all_accounts_are_exhausted

This commit is contained in:
dave
2026-04-27 18:39:35 +00:00
parent 80661fa622
commit 4b64bc614f
8 changed files with 187 additions and 4 deletions
@@ -93,6 +93,27 @@ pub fn format_rate_limit_notification(
(plain, html)
}
/// Format an OAuth account-swap notification message.
///
/// Sent when the pool successfully rotates to a new account after a rate-limit.
/// Returns `(plain_text, html)` suitable for `ChatTransport::send_message`.
pub fn format_oauth_account_swapped(new_email: &str) -> (String, String) {
let plain = format!("\u{1f504} OAuth account rotated \u{2014} now using {new_email}");
let html =
format!("\u{1f504} OAuth account rotated \u{2014} now using <strong>{new_email}</strong>");
(plain, html)
}
/// Format an OAuth accounts-exhausted notification message.
///
/// Sent when all pool accounts are rate-limited and no swap was possible.
/// Returns `(plain_text, html)` suitable for `ChatTransport::send_message`.
pub fn format_oauth_accounts_exhausted(earliest_reset_msg: &str) -> (String, String) {
let plain = format!("\u{26d4} {earliest_reset_msg}");
let html = format!("\u{26d4} {earliest_reset_msg}");
(plain, html)
}
#[cfg(test)]
mod tests {
use super::*;