Skip to content
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

Reviewing PRs: Ctrl+Enter submits comment instead of starting a review #23241

Closed
drsybren opened this issue Mar 2, 2023 · 3 comments · Fixed by #23245
Closed

Reviewing PRs: Ctrl+Enter submits comment instead of starting a review #23241

drsybren opened this issue Mar 2, 2023 · 3 comments · Fixed by #23245
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug

Comments

@drsybren
Copy link
Contributor

drsybren commented Mar 2, 2023

Description

When writing an inline comment on a pull request, the "Start review" button is highlighted as the primary button for the text area:

image

However, when pressing Ctrl+Enter on the keyboard, it is interpreted as pressing the "Add single comment" button.

The biggest issue here is that the "Add single comment" button immediately submits the comment. There is no way to undo this, whereas accidentally starting a review does not immediately send something to the PR author, and thus the review can be cancelled at a later time without bothering anyone, in case it was started by accident.

Gitea Version

1.19.0+dev-649-g2093ca517

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Self-built from Git

Database

None

@delvh delvh added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Mar 2, 2023
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 2, 2023

This behavior comes from

Why the Ctrl+Enter doesn't trigger the default primary button: because in the review form, users might not want to approve the PR, they might just want to leave a comment.

I agree to improve the UX, while some details could be fine-tuned and considered together.

A quick fix could be: change some forms' default actions, some forms use "start review" while some forms use "comment"

image

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 2, 2023

Quickly go through the code again, making the "Start Review" button as the default action seems not an easy task (not just minutes, but maybe hours?), maybe that's the reason why I didn't touch them last time when I added the Ctrl+Enter support .... I can still see my comment for name="is_review" value="true" in code 😂


Update: I tried to proposed a fix (more complicated than I thought ...), did some quick tests, it seems working as expected.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 2, 2023

Please test this fix: Make Ctrl+Enter submit a pending comment (starting review) instead of submitting a single comment #23245

techknowlogick added a commit that referenced this issue Mar 4, 2023
… submitting a single comment (#23245)

Close #23241

Before: press Ctrl+Enter in the Code Review Form, a single comment will
be added.

After: press Ctrl+Enter in the Code Review Form, start the review with
pending comments.


The old name `is_review` is not clear, so the new code use
`pending_review` as the new name.

Co-authored-by: delvh <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
3 participants