Backport #23551 by @silverwind Fix regression from https://github.com/go-gitea/gitea/pull/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 Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
parent
420d015b76
commit
1a97a84023
1 changed files with 15 additions and 13 deletions
|
@ -515,20 +515,22 @@ 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');
|
||||||
|
|
||||||
const tippy = createTippy($reviewBtn[0], {
|
if ($reviewBtn.length && $panel.length) {
|
||||||
content: $panel[0],
|
const tippy = createTippy($reviewBtn[0], {
|
||||||
placement: 'bottom',
|
content: $panel[0],
|
||||||
trigger: 'click',
|
placement: 'bottom',
|
||||||
role: 'menu',
|
trigger: 'click',
|
||||||
maxWidth: 'none',
|
role: 'menu',
|
||||||
interactive: true,
|
maxWidth: 'none',
|
||||||
hideOnClick: true,
|
interactive: true,
|
||||||
});
|
hideOnClick: true,
|
||||||
|
});
|
||||||
|
|
||||||
$closeBtn.on('click', (e) => {
|
$closeBtn.on('click', (e) => {
|
||||||
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue