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

Posting a commit in PR via "Ctrl+Enter" finishes the review process #20990

Closed
Artalus opened this issue Aug 29, 2022 · 2 comments · Fixed by #20992
Closed

Posting a commit in PR via "Ctrl+Enter" finishes the review process #20990

Artalus opened this issue Aug 29, 2022 · 2 comments · Fixed by #20992
Labels

Comments

@Artalus
Copy link

Artalus commented Aug 29, 2022

Description

Posting a comment with Ctrl+Enter does not add it to the "review queue", but instead publishes the whole "queue" immediately.
Introduced in 1.17 with #19729.

  1. Make a PR and go to "files changed" section.
  2. Write a comment somewhere. Notice that there are "Start review" and "Add single comment" buttons.
  3. Click "Start review". The comment now has yellow "pending" label.
  4. Add another comment. Notice that there is only one button now, "Add comment".
  5. Instead of clicking the button, hit Ctrl+Enter. The new comment will have gray "review" label, while the old one still has yellow "pending".
  6. Try to write another comment. Notice that "Start review" and "Add single comment" are back.
  7. Refresh the page. Both comments have "review" label. If you go to "conversation", both comments are visible.

Gitea Version

1.17

Can you reproduce the bug on the Gitea demo site?

Yes

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Aug 29, 2022

The problem is that the review comment UI is inside a form, then the quick-submit handler triggers submit event and it's ambiguous.

To make the logic correct and fix the issue, the AJAX related inputs should be (refactored) moved out of the form, and handle ce-quick-submit event by customized code.

Related code:

  • initRepoDiffConversationForm in repo-diff.js
  • <form ...> in comment_form.tmpl

Maybe there could be another fix: set the is_review=true if the form only contains one Add comment button.

@wxiaoguang
Copy link
Contributor

I think #20992 will fix the problem. I have tested it on my side.

zeripath pushed a commit that referenced this issue Sep 2, 2022
If there is only one "Add comment" button (when there are pending review comments), the quick-submit should submit the form with is_review=true even if the "Add comment" button is not really clicked.

Close  #20990
@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants