Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-26 03:36:10 +01:00

Fix JS error on compare page (#23551)

Fix regression from #23271.
This code apparently runs on the compare page where there is no review button so check for existance of both button and content.

<img width="1226" alt="Screenshot 2023-03-17 at 21 42 47"
src="https://user-images.githubusercontent.com/115237/226040001-ec097edd-d926-4c80-9962-526f9b7eff19.png">

Fixes #23562
This commit is contained in:
silverwind 2023-03-18 22:08:38 +01:00 committed by GitHub
parent 7eede7f8de
commit 53b609e336
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -516,6 +516,7 @@ export function initRepoPullRequestReview() {
const $panel = $reviewBtn.parent().find('.review-box-panel'); const $panel = $reviewBtn.parent().find('.review-box-panel');
const $closeBtn = $panel.find('.close'); const $closeBtn = $panel.find('.close');
if ($reviewBtn.length && $panel.length) {
const tippy = createTippy($reviewBtn[0], { const tippy = createTippy($reviewBtn[0], {
content: $panel[0], content: $panel[0],
placement: 'bottom', placement: 'bottom',
@ -530,6 +531,7 @@ export function initRepoPullRequestReview() {
e.preventDefault(); e.preventDefault();
tippy.hide(); tippy.hide();
}); });
}
$(document).on('click', 'a.add-code-comment', async function (e) { $(document).on('click', 'a.add-code-comment', async function (e) {
if ($(e.target).hasClass('btn-add-single')) return; // https://github.com/go-gitea/gitea/issues/4745 if ($(e.target).hasClass('btn-add-single')) return; // https://github.com/go-gitea/gitea/issues/4745