summaryrefslogtreecommitdiff
path: root/source/features/hide-inactive-deployments.tsx
blob: b64d5ca563ce50f24c08c1faf221d7c6d81c4ada (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
import select from 'select-dom';
import features from '../libs/features';

function init(): void {
	const deployments = select.all('.discussion-item .deployment-meta');
	deployments.pop(); // Don't hide the last deployment, even if it is inactive

	for (const deployment of deployments) {
		if (select.exists('.is-inactive', deployment)) {
			(deployment.closest('.discussion-item') as HTMLElement).hidden = true;
		}
	}
}

features.add({
	id: __featureName__,
	description: 'Hides inactive deployments in PRs.',
	screenshot: 'https://github.com/sindresorhus/refined-github/issues/1144',
	include: [
		features.isPRConversation
	],
	load: features.onNewComments,
	init
});