|
@@ -12,42 +12,53 @@ pub async fn render(db: &DbClient, user: &str) -> String {
|
|
|
let mut out = String::new();
|
|
|
out.push_str("<html>");
|
|
|
out.push_str("<head>");
|
|
|
+ out.push_str("<meta charset=\"utf-8\">");
|
|
|
out.push_str("<title>Triagebot Notification Data</title>");
|
|
|
out.push_str("</head>");
|
|
|
out.push_str("<body>");
|
|
|
|
|
|
out.push_str(&format!("<h3>Pending notifications for {}</h3>", user));
|
|
|
|
|
|
- out.push_str("<ol>");
|
|
|
- for notification in notifications {
|
|
|
- out.push_str("<li>");
|
|
|
- out.push_str(&format!(
|
|
|
- "<a href='{}'>{}</a>",
|
|
|
- notification.origin_url,
|
|
|
- notification
|
|
|
- .short_description
|
|
|
- .as_ref()
|
|
|
- .unwrap_or(¬ification.origin_url)
|
|
|
- .replace('&', "&")
|
|
|
- .replace('<', "<")
|
|
|
- .replace('>', ">")
|
|
|
- .replace('"', """)
|
|
|
- .replace('\'', "'"),
|
|
|
- ));
|
|
|
- if let Some(metadata) = ¬ification.metadata {
|
|
|
+ if notifications.is_empty() {
|
|
|
+ out.push_str("<p><em>You have no pending notifications! :)</em></p>");
|
|
|
+ } else {
|
|
|
+ out.push_str("<ol>");
|
|
|
+ for notification in notifications {
|
|
|
+ out.push_str("<li>");
|
|
|
out.push_str(&format!(
|
|
|
- "<ul><li>{}</li></ul>",
|
|
|
- metadata
|
|
|
+ "<a href='{}'>{}</a>",
|
|
|
+ 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!(
|
|
|
+ "<ul><li>{}</li></ul>",
|
|
|
+ metadata
|
|
|
+ .replace('&', "&")
|
|
|
+ .replace('<', "<")
|
|
|
+ .replace('>', ">")
|
|
|
+ .replace('"', """)
|
|
|
+ .replace('\'', "'"),
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ out.push_str("</li>");
|
|
|
}
|
|
|
- out.push_str("</li>");
|
|
|
+ out.push_str("</ol>");
|
|
|
+
|
|
|
+ out.push_str(
|
|
|
+ "<p><em>You can acknowledge notifications by sending <code>ack <idx></code> \
|
|
|
+ to <b>@triagebot</b> on Zulip. Read about the other notification commands \
|
|
|
+ <a href=\"https://forge.rust-lang.org/platforms/zulip/triagebot.html#issue-notifications\">here</a>.</em></p>"
|
|
|
+ );
|
|
|
}
|
|
|
- out.push_str("</ol>");
|
|
|
|
|
|
out.push_str("</body>");
|
|
|
out.push_str("</html>");
|