Move or copy "Convert to draft" to PR’s mergeability box #3213
fregante posted onGitHub
While "draft PRs" are kind of related to reviewers:
<img width="250" alt="Convert to draft in sidebar" src="https://user-images.githubusercontent.com/1402241/84258590-798b6f00-ab17-11ea-8157-7b8cd3f03fdb.png">
it's not where I expect to find the action, especially since "Ready for review" is in the mergeability box
<img width="929" alt="Ready for review in mergeability box" src="https://user-images.githubusercontent.com/1402241/84258719-af305800-ab17-11ea-9ebf-b068d0588a0a.png">
so I think it should copied or moved to the mergeability box, especially since https://github.com/sindresorhus/refined-github/pull/3211 makes room in it.
<img width="923" alt="" src="https://user-images.githubusercontent.com/1402241/84258819-dbe46f80-ab17-11ea-89a8-ee22c75b2303.png">
This seems easy to do: just copy the details
element from the sidebar and replace the above element. This is what the sidebar's element looks like:
<details class="details-reset details-overlay d-inline">
<summary role="button" class="btn-link muted-link">Convert to draft</summary>
<details-dialog class="Box Box--overlay anim-fade-in fast" role="dialog" aria-modal="true">
{et cetera}
</details-dialog>
</details>
A couple of additional changes need to be done too:
- remove
.muted-link
- remove element once it's converted to draft; for some reason this doesn't happen like it happens for the sidebar. It's probably because the sidebar updates as a whole, implicitly removing the element. Probably this can be detected with
onReplacedElement
(it needs to be modified to have a second callback on "not found, exiting loop")