Skip to content

Commit

Permalink
Refactor message display text formatting (trim the body)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrxy committed Sep 27, 2024
1 parent ced23c3 commit 78b8243
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/dashboard_defs/twilio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,12 @@ impl TwilioStateData {
}

fn make_message_display_text(age_data: MessageAgeData, body: &str, maybe_from: Option<&str>) -> String {
let trimmed_body = body.trim();
let display_text = if let Some((unit_name, plural_suffix, unit_amount)) = age_data {
format!("{unit_amount} {unit_name}{plural_suffix} ago: '{body}'")
format!("{unit_amount} {unit_name}{plural_suffix} ago: '{trimmed_body}'")
}
else {
format!("Right now: '{body}'")
format!("Right now: '{trimmed_body}'")
};

//////////
Expand Down

0 comments on commit 78b8243

Please sign in to comment.