🐛 fix(gmail): display message date and subject

- Refactor log_message_subjects to log_messages for clarity
- Simplify date and subject retrieval in log_messages
- Use MessageSummary's list_date_and_subject for logging
- Elide subject in MessageSummary for consistent display
This commit is contained in:
Jeremiah Russell
2025-10-14 17:00:37 +01:00
committed by Jeremiah Russell
parent f9e86bf8d9
commit 37d02bd0bf
3 changed files with 12 additions and 27 deletions

View File

@@ -1,3 +1,5 @@
use crate::utils::Elide;
#[derive(Debug, Clone)]
pub struct MessageSummary {
id: String,
@@ -18,8 +20,8 @@ impl MessageSummary {
&self.id
}
pub(crate) fn set_subject(&mut self, subject: &str) {
self.subject = Some(subject.to_string())
pub(crate) fn set_subject(&mut self, subject: Option<String>) {
self.subject = subject
}
pub(crate) fn subject(&self) -> &str {
@@ -30,8 +32,8 @@ impl MessageSummary {
}
}
pub(crate) fn set_date(&mut self, date: &str) {
self.date = Some(date.to_string())
pub(crate) fn set_date(&mut self, date: Option<String>) {
self.date = date
}
pub(crate) fn date(&self) -> &str {
@@ -51,7 +53,7 @@ impl MessageSummary {
return "***invalid date or subject***".to_string();
};
let s = date[5..16].to_string();
let s = format!("{s}: {subject}");
let s = format!("{s}: {}", subject.to_string().elide(24));
s
}
}