Require codereview to have content (#18156)

- Report a validityError when the codeReview have no comment.
- Resolves #18151
- Refactor
This commit is contained in:
Gusted 2022-01-02 22:31:03 +00:00 committed by GitHub
parent 948949f429
commit 496acbe9e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 13 deletions

View file

@ -1,5 +1,6 @@
import {initCompReactionSelector} from './comp/ReactionSelector.js';
import {initRepoIssueContentHistory} from './repo-issue-content.js';
import {validateTextareaNonEmpty} from './comp/CommentEasyMDE.js';
const {csrfToken} = window.config;
export function initRepoDiffReviewButton() {
@ -23,7 +24,13 @@ export function initRepoDiffFileViewToggle() {
export function initRepoDiffConversationForm() {
$(document).on('submit', '.conversation-holder form', async (e) => {
e.preventDefault();
const form = $(e.target);
const $textArea = form.find('textarea');
if (!validateTextareaNonEmpty(form, $textArea)) {
return;
}
const newConversationHolder = $(await $.post(form.attr('action'), form.serialize()));
const {path, side, idx} = newConversationHolder.data();