diff --git a/src/commands.rs b/src/commands.rs index c2aa26a..71a275f 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -76,6 +76,11 @@ pub trait ResponseExtractor { impl ResponseExtractor for CommandResult { /// Error message in bolded HTML. fn message_html(&self, username: &str) -> String { + //TODO use user display name too + let username = format!( + "{}", + username, username + ); match self { Ok(resp) => format!("

{}

{}

", username, resp.html).replace("\n", "
"), Err(e) => format!("

{}

{}

", username, e.html()).replace("\n", "
"), @@ -112,6 +117,15 @@ mod tests { }; } + #[test] + fn command_result_extractor_creates_bubble() { + let result = Execution::new("test".to_string()); + let message = result.message_html("@myuser:example.com"); + assert!(message.contains( + "@myuser:example.com" + )); + } + #[tokio::test] async fn unrecognized_command() { let db = crate::db::Database::new_temp().unwrap();