Skip to content

Commit e48beb9

Browse files
parnicparnic-sks
authored andcommitted
Allow commit status popup on /pulls page (go-gitea#19507)
* Allow commit status popup on /pulls page The /pulls page doesn't contain a "repository" element, so the early-out here was preventing the commit status popup hook from working. However, the only thing the .repository element is being used for here is determining whether the popup should be on the right or on the left, so we don't actually need the element to exist for the hook to work. Pull request go-gitea#19375 allows the statuses on /pulls pages to appear clickable, but this commit is required to make the popup actually work there. * Move commit statuses popup hook to dedicated func * Add missing import
1 parent 28c3740 commit e48beb9

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

web_src/js/features/repo-commit.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,16 @@ export function initRepoCommitLastCommitLoader() {
4747
});
4848
});
4949
}
50+
51+
export function initCommitStatuses() {
52+
$('.commit-statuses-trigger').each(function () {
53+
const positionRight = $('.repository.file.list').length > 0 || $('.repository.diff').length > 0;
54+
const popupPosition = positionRight ? 'right center' : 'left center';
55+
$(this)
56+
.popup({
57+
on: 'click',
58+
lastResort: popupPosition, // prevent error message "Popup does not fit within the boundaries of the viewport"
59+
position: popupPosition,
60+
});
61+
});
62+
}

web_src/js/features/repo-legacy.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -422,18 +422,6 @@ export function initRepository() {
422422
}
423423

424424

425-
// Commit statuses
426-
$('.commit-statuses-trigger').each(function () {
427-
const positionRight = $('.repository.file.list').length > 0 || $('.repository.diff').length > 0;
428-
const popupPosition = positionRight ? 'right center' : 'left center';
429-
$(this)
430-
.popup({
431-
on: 'click',
432-
lastResort: popupPosition, // prevent error message "Popup does not fit within the boundaries of the viewport"
433-
position: popupPosition,
434-
});
435-
});
436-
437425
// File list and commits
438426
if ($('.repository.file.list').length > 0 ||
439427
$('.repository.commits').length > 0 || $('.repository.release').length > 0) {

web_src/js/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ import {
3636
initRepoPullRequestMergeInstruction,
3737
initRepoPullRequestReview,
3838
} from './features/repo-issue.js';
39-
import {initRepoEllipsisButton, initRepoCommitLastCommitLoader} from './features/repo-commit.js';
39+
import {
40+
initRepoEllipsisButton,
41+
initRepoCommitLastCommitLoader,
42+
initCommitStatuses,
43+
} from './features/repo-commit.js';
4044
import {
4145
initFootLanguageMenu,
4246
initGlobalButtonClickOnEnter,
@@ -161,6 +165,8 @@ $(document).ready(() => {
161165
initRepoWikiForm();
162166
initRepository();
163167

168+
initCommitStatuses();
169+
164170
initUserAuthLinkAccountView();
165171
initUserAuthOauth2();
166172
initUserAuthWebAuthn();

0 commit comments

Comments
 (0)