From ffe5fe905903c90f1c20354359f4b02671f60431 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Thu, 8 Jan 2026 23:40:30 +0100 Subject: [PATCH] issue/list: Fix empty reactions being rendered --- bin/commands/issue/list.rs | 41 +++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/bin/commands/issue/list.rs b/bin/commands/issue/list.rs index 28427485..3e38e86b 100644 --- a/bin/commands/issue/list.rs +++ b/bin/commands/issue/list.rs @@ -1095,31 +1095,36 @@ impl App { } pub fn show_comment(&self, frame: &mut Frame, ui: &mut Ui) { - let (text, footer, mut cursor) = { + let (text, reactions, mut cursor) = { let comment = self.state.preview.selected_comment(); let body: String = comment .map(|comment| comment.body.clone()) .unwrap_or_default(); - let reactions = comment - .map(|comment| { - let reactions = comment.accumulated_reactions().iter().fold( - String::new(), - |all, (r, acc)| { - if *acc > 1_usize { - [all, format!("{r}{acc} ")].concat() - } else { - [all, format!("{r} ")].concat() - } - }, - ); - reactions - }) - .unwrap_or_default(); + let reactions = comment.and_then(|comment| { + let reactions = comment.accumulated_reactions(); + if !reactions.is_empty() { + let reactions = reactions.iter().fold(String::new(), |all, (r, acc)| { + if *acc > 1_usize { + [all, format!("{r}{acc} ")].concat() + } else { + [all, format!("{r} ")].concat() + } + }); + Some(reactions) + } else { + None + } + }); (body, reactions, self.state.preview.comment.clone().cursor()) }; - let comment = - ui.text_view_with_footer(frame, text, footer, &mut cursor, Some(Borders::All)); + let comment = match reactions { + Some(reactions) => { + ui.text_view_with_footer(frame, text, reactions, &mut cursor, Some(Borders::All)) + } + None => ui.text_view(frame, text, &mut cursor, Some(Borders::All)), + }; + if comment.changed { ui.send_message(Message::Changed(Change::CommentBody { state: TextViewState::new(cursor),