From e0741b2b71942149a3a10ad7c4f693879ce76811 Mon Sep 17 00:00:00 2001 From: gizmo385 Date: Sat, 21 Dec 2024 09:10:49 +0000 Subject: [PATCH] Tweak conversation rendering so reviews without content show up Previously if you had a PR that was approved but the approver didn't include a message, the review simply wouldn't show up in the UI --- lazy_github/ui/widgets/conversations.py | 9 +++++---- lazy_github/ui/widgets/pull_requests.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lazy_github/ui/widgets/conversations.py b/lazy_github/ui/widgets/conversations.py index cbdac4d..8aed339 100644 --- a/lazy_github/ui/widgets/conversations.py +++ b/lazy_github/ui/widgets/conversations.py @@ -111,10 +111,11 @@ def compose(self) -> ComposeResult: else: review_state_text = self.review.state.title() yield Label(f"Review from {self.review.user.login} ({review_state_text})") - yield Markdown(self.review.body) - for comment in self.review.comments: - if comment_node := self.hierarchy[comment.id]: - yield ReviewConversation(self.pr, comment_node) + if self.review.body: + yield Markdown(self.review.body) + for comment in self.review.comments: + if comment_node := self.hierarchy[comment.id]: + yield ReviewConversation(self.pr, comment_node) def action_reply_to_review(self) -> None: self.app.push_screen(NewCommentModal(self.pr.repo, self.pr, self.review)) diff --git a/lazy_github/ui/widgets/pull_requests.py b/lazy_github/ui/widgets/pull_requests.py index a375053..6a9931d 100644 --- a/lazy_github/ui/widgets/pull_requests.py +++ b/lazy_github/ui/widgets/pull_requests.py @@ -315,8 +315,8 @@ async def fetch_conversation(self) -> None: for review in reviews: if review.body: handled_comment_node_ids.extend([c.id for c in review.comments]) - review_container = ReviewContainer(self.pr, review, review_hierarchy) - self.comments_and_reviews.mount(review_container) + review_container = ReviewContainer(self.pr, review, review_hierarchy) + self.comments_and_reviews.mount(review_container) for comment in comments: if comment.body and comment.id not in handled_comment_node_ids: