blob: 404b7dcb76fc70cbc2aa6b64531cf8dc0c1ff7e6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
/*
*/
import select from 'select-dom';
import features from '../libs/features';
function init(): false | void {
// If there's a settings tab, the current user can enable checks,
// so the tab should not be hidden
if (select.exists([
'.js-repo-nav [data-selected-links^="repo_settings"]', // In repos
'.pagehead-tabs-item[href$="/settings/profile"]' // In organizations
].join())) {
return false;
}
// Only remove the tab if it's not the current page and if it has 0 checks
const checksCounter = select('.tabnav-tab[href$="/checks"]:not(.selected) .Counter');
if (checksCounter && checksCounter.textContent!.trim() === '0') {
checksCounter.parentElement!.remove();
}
}
features.add({
id: __featureName__,
description: 'Hides the `Checks` tab if it’s empty, unless you’re the owner.',
screenshot: false,
include: [
features.isPR
],
load: features.onAjaxedPages,
init
});
|