Allow chats to choose a locale
This commit is contained in:
@@ -12,6 +12,7 @@ pub struct DbChat {
|
||||
next_appointment_end: Option<i64>,
|
||||
last_reminder: Option<i64>,
|
||||
pinned_message: Option<i32>,
|
||||
locale: Option<String>,
|
||||
}
|
||||
|
||||
pub struct ChatInfo<Tz: TimeZone> {
|
||||
@@ -20,6 +21,7 @@ pub struct ChatInfo<Tz: TimeZone> {
|
||||
pub next_appointment: Option<Appointment<Tz>>,
|
||||
pub last_reminder: Option<DateTime<Tz>>,
|
||||
pub pinned_message_id: Option<i32>,
|
||||
pub locale: String,
|
||||
}
|
||||
|
||||
impl From<DbChat> for ChatInfo<Utc> {
|
||||
@@ -42,12 +44,15 @@ impl From<DbChat> for ChatInfo<Utc> {
|
||||
.map(|timestamp| NaiveDateTime::from_timestamp(timestamp, 0))
|
||||
.map(|date_time| DateTime::<Utc>::from_utc(date_time, Utc));
|
||||
|
||||
let locale = db_chat.locale.unwrap_or("de".into());
|
||||
|
||||
ChatInfo {
|
||||
id: db_chat.telegram_id,
|
||||
calendar: db_chat.calendar,
|
||||
next_appointment: next_appointment,
|
||||
last_reminder,
|
||||
pinned_message_id: db_chat.pinned_message,
|
||||
locale,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user