|
@@ -9,6 +9,10 @@ pub struct Notification {
|
|
|
pub origin_html: String,
|
|
|
pub short_description: Option<String>,
|
|
|
pub time: DateTime<FixedOffset>,
|
|
|
+
|
|
|
+ /// If this is Some, then the notification originated in a team-wide ping
|
|
|
+ /// (e.g., @rust-lang/libs). The String is the team name (e.g., libs).
|
|
|
+ pub team_name: Option<String>,
|
|
|
}
|
|
|
|
|
|
pub async fn record_ping(db: &DbClient, notification: &Notification) -> anyhow::Result<()> {
|
|
@@ -19,8 +23,8 @@ pub async fn record_ping(db: &DbClient, notification: &Notification) -> anyhow::
|
|
|
.await
|
|
|
.context("inserting user id / username")?;
|
|
|
|
|
|
- db.execute("INSERT INTO notifications (user_id, origin_url, origin_html, time, short_description) VALUES ($1, $2, $3, $4, $5)",
|
|
|
- &[¬ification.user_id, ¬ification.origin_url, ¬ification.origin_html, ¬ification.time, ¬ification.short_description],
|
|
|
+ db.execute("INSERT INTO notifications (user_id, origin_url, origin_html, time, short_description, team_name) VALUES ($1, $2, $3, $4, $5, $6)",
|
|
|
+ &[¬ification.user_id, ¬ification.origin_url, ¬ification.origin_html, ¬ification.time, ¬ification.short_description, ¬ification.team_name],
|
|
|
).await.context("inserting notification")?;
|
|
|
|
|
|
Ok(())
|