blob: 6e5b817136ca6fc7e5e1dbc0bf6818425ef3fc48 (
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
36
|
/*
*/
import select from 'select-dom';
import features from '../libs/features';
import * as pageDetect from '../libs/page-detect';
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
])) {
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: __filebasename,
description: 'Hides the `Checks` tab if it’s empty, unless you’re the owner.',
screenshot: false
}, {
include: [
pageDetect.isPR
],
init
});
|