summaryrefslogtreecommitdiff
path: root/source/features/mark-files-as-viewed.tsx
blob: d1527c0df4833219f3c3e90be249a341026a2bb1 (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 delegate from 'delegate-it';
import features from '../libs/features';

function markAllFilesAsViewed(): void {
	for (const checkbox of select.all('.js-reviewed-checkbox:not(:checked)')) {
		checkbox.click();
	}
}

function init(): void {
	delegate('.form-actions button[value="approve"]', 'click', () => markAllFilesAsViewed());
}

features.add({
	disabled: '#2252',
	id: __featureName__,
	description: 'Marks all files as "viewed" when approving a PR.',
	screenshot: 'https://user-images.githubusercontent.com/11782/60969312-8740df00-a31f-11e9-8e34-d1f0c1a871aa.gif',
	include: [
		features.isPR
	],
	init
});