Skip to content

Commit

Permalink
Fix separate-draft-pr-button position (#3873)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheap-glitch committed Jan 10, 2021
1 parent 4277826 commit 434297a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/features/separate-draft-pr-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ function init(): void | false {
return false;
}

const buttonBar = select('.timeline-comment > :last-child', previewForm)!;
const createPrButtonGroup = select('.BtnGroup', buttonBar);
const createPrButtonGroup = select('.hx_create-pr-button');
if (!createPrButtonGroup) {
// Free accounts can't open Draft PRs in private repos, so this element is missing
return false;
}

const createPrDropdownItems = select.all('.select-menu-item', createPrButtonGroup);
const createPrDropdownItems = select.all('.select-menu-item', previewForm);

for (const dropdownItem of createPrDropdownItems) {
let title = select('.select-menu-item-heading', dropdownItem)!.textContent!.trim();
Expand All @@ -34,7 +33,7 @@ function init(): void | false {
classList.push('btn-primary');
}

buttonBar.prepend(
createPrButtonGroup.after(
<button
className={classList.join(' ')}
aria-label={description}
Expand All @@ -47,6 +46,7 @@ function init(): void | false {
);
}

select('details', createPrButtonGroup.parentElement!)!.remove();
createPrButtonGroup.remove();
}

Expand Down

0 comments on commit 434297a

Please sign in to comment.