From fb501249462f82a7b80facb47343777326d9d6ac Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Sun, 5 Oct 2025 14:32:52 -1000 Subject: [PATCH] Fix validation logic to show all error messages and add explicit class name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change validation logic from if/else chain to independent if statements This ensures both "Author" and "Text" error messages are displayed when both fields are blank, rather than just showing one error at a time - Add explicit class name CommentsController for better debugging and compatibility with future transpiler changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- client/app/controllers/comments_controller.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/client/app/controllers/comments_controller.js b/client/app/controllers/comments_controller.js index 14ee314a7..594d43fbc 100644 --- a/client/app/controllers/comments_controller.js +++ b/client/app/controllers/comments_controller.js @@ -7,7 +7,7 @@ import { mangle } from 'marked-mangle'; marked.use(gfmHeadingId()); marked.use(mangle()); -export default class extends Controller { +export default class CommentsController extends Controller { static targets = ['commentList', 'commentAuthor', 'commentText', 'commentRefresh', 'alertDiv', 'errorList']; resetText() { @@ -22,10 +22,8 @@ export default class extends Controller { errorList.innerHTML = ''; if (!inputAuthor.value) { errors.push('Author'); - } else if (!inputText.value) { - errors.push('Text'); - } else { - errors.push('Author'); + } + if (!inputText.value) { errors.push('Text'); } errors.forEach((error) => {