diff options
Diffstat (limited to 'source/features/one-click-pr-or-gist.tsx')
-rw-r--r-- | source/features/one-click-pr-or-gist.tsx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source/features/one-click-pr-or-gist.tsx b/source/features/one-click-pr-or-gist.tsx index 9762a064..6d7cfd0a 100644 --- a/source/features/one-click-pr-or-gist.tsx +++ b/source/features/one-click-pr-or-gist.tsx @@ -4,17 +4,16 @@ import select from 'select-dom'; import * as pageDetect from 'github-url-detection'; import features from '.'; +import selectHas from '../helpers/select-has'; function init(): void | false { - const draftPROption = select('.new-pr-form [name="draft"], #new_gist [name="gist[public]"]'); - if (!draftPROption) { + const initialGroupedButtons = selectHas('.BtnGroup:has([name="draft"], [name="gist[public]"])'); + if (!initialGroupedButtons) { // 1. Free accounts can't open Draft PRs in private repos, so this element is missing // 2. PRs can't be created from some comparison pages: Either base is a tag, not a branch; or there already exists a PR. return false; } - const initialGroupedButtons = draftPROption.closest('.BtnGroup')!; - for (const dropdownItem of select.all('.select-menu-item', initialGroupedButtons)) { let title = select('.select-menu-item-heading', dropdownItem)!.textContent!.trim(); const description = select('.description', dropdownItem)!.textContent!.trim(); |