Skip to content

Commit 0b4ff15

Browse files
authored
Solving the issue of UI disruption when the review is deleted without refreshing (#29951)
**After deleting the review and refreshing, the display is normal. However, Without refreshing, the interface will be broken** https://github.com/go-gitea/gitea/assets/37935145/f5cb19a6-eb26-47b0-b8ee-15b575bbe1ac **after** https://github.com/go-gitea/gitea/assets/37935145/aa65922c-2ebf-4fce-ad91-35661f70329a
1 parent 1a4f693 commit 0b4ff15

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

web_src/js/features/repo-issue.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ export function initRepoIssueCommentDelete() {
162162
const response = await POST($this.data('url'));
163163
if (!response.ok) throw new Error('Failed to delete comment');
164164
const $conversationHolder = $this.closest('.conversation-holder');
165-
165+
const $parentTimelineItem = $this.closest('.timeline-item');
166+
const $parentTimelineGroup = $this.closest('.timeline-item-group');
166167
// Check if this was a pending comment.
167168
if ($conversationHolder.find('.pending-label').length) {
168169
const $counter = $('#review-box .review-comments-counter');
@@ -185,6 +186,11 @@ export function initRepoIssueCommentDelete() {
185186
}
186187
$conversationHolder.remove();
187188
}
189+
// Check if there is no review content, move the time avatar upward to avoid overlapping the content below.
190+
if (!$parentTimelineGroup.find('.timeline-item.comment').length && !$parentTimelineItem.find('.conversation-holder').length) {
191+
const $timelineAvatar = $parentTimelineGroup.find('.timeline-avatar');
192+
$timelineAvatar.removeClass('timeline-avatar-offset');
193+
}
188194
} catch (error) {
189195
console.error(error);
190196
}

0 commit comments

Comments
 (0)