From 456a33e8bb770a86341dc883edc6b62264b950a1 Mon Sep 17 00:00:00 2001 From: HEREYUA <37935145+HEREYUA@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:03:01 +0800 Subject: [PATCH] Solving the issue of UI disruption when the review is deleted without refreshing (#29951) (#29968) backport #29951 (cherry picked from commit 3ff3c5ba780bc1b01004b9d0f8b4d56dd1aa9820) --- web_src/js/features/repo-issue.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index 0be118db31..ecddbe15a9 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -162,7 +162,8 @@ export function initRepoIssueCommentDelete() { _csrf: csrfToken, }).done(() => { const $conversationHolder = $this.closest('.conversation-holder'); - + const $parentTimelineItem = $this.closest('.timeline-item'); + const $parentTimelineGroup = $this.closest('.timeline-item-group'); // Check if this was a pending comment. if ($conversationHolder.find('.pending-label').length) { const $counter = $('#review-box .review-comments-counter'); @@ -185,6 +186,11 @@ export function initRepoIssueCommentDelete() { } $conversationHolder.remove(); } + // Check if there is no review content, move the time avatar upward to avoid overlapping the content below. + if (!$parentTimelineGroup.find('.timeline-item.comment').length && !$parentTimelineItem.find('.conversation-holder').length) { + const $timelineAvatar = $parentTimelineGroup.find('.timeline-avatar'); + $timelineAvatar.removeClass('timeline-avatar-offset'); + } }); } return false;