Skip to content

Commit 02ee907

Browse files
committed
update
1 parent 6aca990 commit 02ee907

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,15 +286,19 @@ TEST: addTests('isQuickPR', [
286286
'https://github.com/sindresorhus/refined-github/compare/test-branch?quick_pull=1',
287287
]);
288288

289-
export const isDraftPR = (): boolean => exists('#partial-discussion-header .octicon-git-pull-request-draft');
290-
export const isOpenPR = (): boolean => exists('#partial-discussion-header :is(.octicon-git-pull-request, .octicon-git-pull-request-draft)');
289+
export const isDraftPR = (): boolean => ($('.State') ?? $('[class^="StateLabel"]'))!.textContent!.trim() === 'Draft';
290+
export const isOpenPR = (): boolean => {
291+
const status = ($('.State') ?? $('[class^="StateLabel"]'))!.textContent!.trim();
292+
return status === 'Open' || status === 'Draft';
293+
};
294+
291295
export const isMergedPR = (): boolean => {
292-
const status = ($('.State') || $('[class^="StateLabel"]'))!.textContent!.trim();
296+
const status = ($('.State') ?? $('[class^="StateLabel"]'))!.textContent!.trim();
293297
return status === 'Merged';
294298
};
295299

296300
export const isClosedPR = (): boolean => {
297-
const status = ($('.State') || $('[class^="StateLabel"]'))!.textContent!.trim();
301+
const status = ($('.State') ?? $('[class^="StateLabel"]'))!.textContent!.trim();
298302
return status === 'Closed' || status === 'Merged';
299303
};
300304

0 commit comments

Comments
 (0)