]> source.dussan.org Git - gitea.git/commitdiff
Solving the issue of UI disruption when the review is deleted without refreshing...
authorHEREYUA <37935145+HEREYUA@users.noreply.github.com>
Thu, 21 Mar 2024 14:03:01 +0000 (22:03 +0800)
committerGitHub <noreply@github.com>
Thu, 21 Mar 2024 14:03:01 +0000 (15:03 +0100)
backport #29951

web_src/js/features/repo-issue.js

index 0be118db31e705a0d8ab0d2aad3b94a66ad291f8..ecddbe15a90f92cec68aae624d4c9954e3d79a5e 100644 (file)
@@ -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;