use crate::db::notifications::get_notifications; pub async fn render(db: &crate::db::PooledClient, user: &str) -> String { let notifications = match get_notifications(db, user).await { Ok(n) => n, Err(e) => { return format!("{:?}", e.context("getting notifications")); } }; let mut out = String::new(); out.push_str(""); out.push_str(""); out.push_str(""); out.push_str("Triagebot Notification Data"); out.push_str(""); out.push_str(""); out.push_str(&format!("

Pending notifications for {}

", user)); if notifications.is_empty() { out.push_str("

You have no pending notifications! :)

"); } else { out.push_str("
    "); for notification in notifications { out.push_str("
  1. "); out.push_str(&format!( "{}", notification.origin_url, notification .short_description .as_ref() .unwrap_or(¬ification.origin_url) .replace('&', "&") .replace('<', "<") .replace('>', ">") .replace('"', """) .replace('\'', "'"), )); if let Some(metadata) = ¬ification.metadata { out.push_str(&format!( "", metadata .replace('&', "&") .replace('<', "<") .replace('>', ">") .replace('"', """) .replace('\'', "'"), )); } out.push_str("
  2. "); } out.push_str("
"); out.push_str( "

You can acknowledge a notification by sending ack <idx> \ to @triagebot on Zulip, or you can acknowledge \ all notifications by sending ack all. Read about the other notification commands \ here.

" ); } out.push_str(""); out.push_str(""); out }