Skip to content

Commit 93b77f8

Browse files
authored
Fix validation logic to show all error messages and add explicit class name (#675)
1 parent 577e4b5 commit 93b77f8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

client/app/controllers/comments_controller.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { mangle } from 'marked-mangle';
77
marked.use(gfmHeadingId());
88
marked.use(mangle());
99

10-
export default class extends Controller {
10+
export default class CommentsController extends Controller {
1111
static targets = ['commentList', 'commentAuthor', 'commentText', 'commentRefresh', 'alertDiv', 'errorList'];
1212

1313
resetText() {
@@ -22,10 +22,8 @@ export default class extends Controller {
2222
errorList.innerHTML = '';
2323
if (!inputAuthor.value) {
2424
errors.push('Author');
25-
} else if (!inputText.value) {
26-
errors.push('Text');
27-
} else {
28-
errors.push('Author');
25+
}
26+
if (!inputText.value) {
2927
errors.push('Text');
3028
}
3129
errors.forEach((error) => {

0 commit comments

Comments
 (0)