Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Require codereview to have content
- Report a validityError when the codeReview have no comment.
- Resolves #18151
  • Loading branch information
Gusted committed Jan 2, 2022
commit 4791c03d21fc11aaeb4d145e3398f70cad766609
12 changes: 12 additions & 0 deletions web_src/js/features/repo-diff.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {initCompReactionSelector} from './comp/ReactionSelector.js';
import {initRepoIssueContentHistory} from './repo-issue-content.js';
import {getAttachedEasyMDE} from './comp/CommentEasyMDE.js';
const {csrfToken} = window.config;

export function initRepoDiffReviewButton() {
Expand All @@ -23,7 +24,18 @@ 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');
const $markdownEditorTextArea = $(getAttachedEasyMDE($textArea).codemirror.getInputField());
if (!$textArea.val().length) {
$markdownEditorTextArea.prop('required', true);
form.get(0).reportValidity();
return;
} else {
$markdownEditorTextArea.prop('required', false);
}

const newConversationHolder = $(await $.post(form.attr('action'), form.serialize()));
const {path, side, idx} = newConversationHolder.data();

Expand Down