Skip to content

Commit

Permalink
fix: inject buttons in the right place (#34)
Browse files Browse the repository at this point in the history
The new merge box selector is too generic. We have to select a section with a precise selector. The conflict section is always injected so we can select it and get the parent element to inject Mergify's buttons.

Fixes MRGFY-4504
Fixes #33
  • Loading branch information
DouglasBlackwood authored Dec 30, 2024
1 parent 87198ec commit aab5c23
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/mergify.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,10 @@ function tryInject() {
// Classic merge box
detailSection.insertBefore(buildMergifySectionForClassicMergeBox(), detailSection.firstChild)
} else {
// New merge box
var detailSection = document.querySelector("div.border:nth-child(2)")
if (detailSection) {
// New merge box (parent div of the conflict section, which is always present)
var conflictSection = document.querySelector("section[aria-label=Conflicts")
if (conflictSection) {
var detailSection = conflictSection.parentElement
detailSection.insertBefore(buildMergifySectionForNewMergeBox(), detailSection.firstChild)
}
}
Expand Down

0 comments on commit aab5c23

Please sign in to comment.