New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore PR review buttons on GitHub Enterprise #6635
Conversation
function replaceCheckboxes(originalSubmitButton: HTMLButtonElement): void { | ||
const form = originalSubmitButton.form!; | ||
const actionsRow = originalSubmitButton.closest('.form-actions')!; | ||
const formAttribute = originalSubmitButton.getAttribute('form')!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By targeting the original submit button, it's easier to extrapolate all the necessary elements without conditions
|
||
// Do not use `select.all` because elements can be outside `form` | ||
// `RadioNodeList` is dynamic, so we need to make a copy | ||
const radios = [...form.elements.namedItem('pull_request_review[event]') as RadioNodeList] as HTMLInputElement[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://stackoverflow.com/a/76206952/288906
Good API, terrible types
// Delay disabling the fields to let them be submitted first | ||
setTimeout(() => { | ||
for (const control of select.all('button, textarea', event.delegateTarget)) { | ||
control.disabled = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved below, handled via temporary preventDefault
instead.
const pendingComments = looseParseInt(select('.js-reviews-toggle .js-pending-review-comment-count')); | ||
const submissionRequiresComment = pendingComments === 0 && (value === 'reject' || value === 'comment'); | ||
select('#pull_request_review_body', form!)!.toggleAttribute('required', submissionRequiresComment); | ||
}, {signal}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropped. This can fail once the .js-reviews-toggle .js-pending-review-comment-count
is not found the the number of comments loosely becomes 0, blocking submission.
} | ||
|
||
void features.add(import.meta.url, { | ||
include: [ | ||
pageDetect.isPR, | ||
pageDetect.isPRFiles, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this was so broad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The review option shows on a specific commit of a PR, that no longer works now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you're talking about this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here: added isPRCommit
as done everywhere else in the extension.
Confirmed this is working on GHE 3.8.2, with the caveat from my comment on your review. Ack, spoke too soon, comment works, approve/request changes also appear to comment and not actually approve/request changes. |
That's strange. Is that GHE? It works here: refined-github/sandbox#53 (review) Would you be able to see why that's happening? This works because each button has a |
I'll see if I can investigate later today.
…On Tue, May 9, 2023, 9:49 AM Federico Brigante ***@***.***> wrote:
approve/request changes also appear to comment and not actually
approve/request changes.
That's strange. Is that GHE? It works here: refined-github/sandbox#53
(review)
<refined-github/sandbox#53 (review)>
Would you be able to see why that's happening?
This works because each button has a value and name and the browser
submits only name/value that was clicked, replacing GitHub‘s radio which do
the same.
—
Reply to this email directly, view it on GitHub
<#6635 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGRMZDQQ3XTKOLSZ33YNJDXFJKN5ANCNFSM6AAAAAAX22XEDU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Narrowed it down to there's a hidden input at the end of the form making it a comment all the time. Haven't gotten to see why or where it's coming from. |
Ohhh we have that in our code right in this file. It’s used to ensure that the default action for ctrl-enter is a comment, regardless of the order of buttons in a PR. I can look into another solution and then ship it |
Swapping to prepend and it works for both scenarios again on GHE. |
Thank you! That makes sense. It used to be:
but now it was
|
Since I disabled the feature via hotfix, this isn't as urgent anymore. I hope to get a couple more bugfixes before releasing a new version |
Uhm, I'm confused. This feature has been "disabled" on GHE for the past 7 months. Why is it enabled? refined-github/source/features/one-click-diff-options.tsx Lines 128 to 135 in ac7d9c5
|
I use on GHE all the time, it has been disabled since the hot fix though and I've missed it. |
one-click-review-submission
) #6633one-click-review-submission
#6619Test URLs
Screenshot
@busches are you able to test it? I think your version was also affected