Skip to content

Commit 9b72d1e

Browse files
committed
Fix null errors on conversation holder (go-gitea#32258) (go-gitea#32266)
Backport go-gitea#32266 fix go-gitea#32258 Errors in the issue was due to unhandled null check. so i fixed it. To reproduce that issue, the comment must be deleted on Conversation tab. <img width="1032" alt="image" src="https://github.com/user-attachments/assets/72df61ba-7db6-44c9-bebc-ca1178dd27f1"> <img width="1010" alt="image" src="https://github.com/user-attachments/assets/36fa537e-4f8e-4535-8d02-e538c50f0dd8"> gitea already have remove logic for `timeline-item-group`, but because of null ref exception the later logic that removes `timeline-item-group` could be not be called correctly. Fix null errors on conversation holder (go-gitea#32258) (go-gitea#32266) fix go-gitea#32258 Errors in the issue was due to unhandled null check. so i fixed it. To reproduce that issue, the comment must be deleted on Conversation tab. <img width="1032" alt="image" src="https://github.com/user-attachments/assets/72df61ba-7db6-44c9-bebc-ca1178dd27f1"> <img width="1010" alt="image" src="https://github.com/user-attachments/assets/36fa537e-4f8e-4535-8d02-e538c50f0dd8"> gitea already have remove logic for `timeline-item-group`, but because of null ref exception the later logic that removes `timeline-item-group` could be not be called correctly.
1 parent 7e0fd4c commit 9b72d1e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

web_src/js/features/repo-issue.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,17 @@ export function initRepoIssueCommentDelete() {
188188
const path = conversationHolder.getAttribute('data-path');
189189
const side = conversationHolder.getAttribute('data-side');
190190
const idx = conversationHolder.getAttribute('data-idx');
191-
const lineType = conversationHolder.closest('tr').getAttribute('data-line-type');
192-
193-
if (lineType === 'same') {
194-
document.querySelector(`[data-path="${path}"] .add-code-comment[data-idx="${idx}"]`).classList.remove('tw-invisible');
195-
} else {
196-
document.querySelector(`[data-path="${path}"] .add-code-comment[data-side="${side}"][data-idx="${idx}"]`).classList.remove('tw-invisible');
191+
const lineType = conversationHolder.closest('tr')?.getAttribute('data-line-type');
192+
193+
// the conversation holder could appear either on the "Conversation" page, or the "Files Changed" page
194+
// on the Conversation page, there is no parent "tr", so no need to do anything for "add-code-comment"
195+
if (lineType) {
196+
if (lineType === 'same') {
197+
document.querySelector(`[data-path="${path}"] .add-code-comment[data-idx="${idx}"]`).classList.remove('tw-invisible');
198+
} else {
199+
document.querySelector(`[data-path="${path}"] .add-code-comment[data-side="${side}"][data-idx="${idx}"]`).classList.remove('tw-invisible');
200+
}
197201
}
198-
199202
conversationHolder.remove();
200203
}
201204

0 commit comments

Comments
 (0)