don't show thesaurus infobox when there are no synonyms

This commit is contained in:
mat 2024-04-04 04:58:46 +00:00
parent e1dadc2ebb
commit ec888ce038

View File

@ -50,6 +50,11 @@ pub struct ThesaurusItem {
pub fn parse_response(body: &str) -> eyre::Result<EngineResponse> { pub fn parse_response(body: &str) -> eyre::Result<EngineResponse> {
let response = parse_thesaurus_com_response(body)?; let response = parse_thesaurus_com_response(body)?;
if response.items.is_empty() {
return Ok(EngineResponse::new());
}
let rendered_html = render_thesaurus_html(response); let rendered_html = render_thesaurus_html(response);
Ok(EngineResponse::answer_html(rendered_html)) Ok(EngineResponse::answer_html(rendered_html))