From 682933f37b5bf4a1ba7bc2d326e48e13ae084e75 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Jul 2025 03:04:40 +0300 Subject: [PATCH 1/5] fixed server error when attempting to create threads failing validation --- app/controllers/comments_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index de2bfede1..d6435ab44 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -32,8 +32,12 @@ def create_thread pings = check_for_pings @comment_thread, body success = ActiveRecord::Base.transaction do - @comment_thread.save! - @comment.save! + thread_success = @comment_thread.save + comment_success = @comment.save + + unless thread_success && comment_success + raise ActiveRecord::Rollback + end end if success From cebb33e22f1174ab258c083670f2013a8d9c0f8b Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Jul 2025 03:22:17 +0300 Subject: [PATCH 2/5] moved new thread modal's char limits to the view's variables section --- app/views/comments/_new_thread_modal.html.erb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/views/comments/_new_thread_modal.html.erb b/app/views/comments/_new_thread_modal.html.erb index 8ea24575f..4c450c1f6 100644 --- a/app/views/comments/_new_thread_modal.html.erb +++ b/app/views/comments/_new_thread_modal.html.erb @@ -2,6 +2,12 @@ Start new comment thread dialog. %> +<% + # TODO: make configurable + min_chars = 15 + max_chars = 1000 +%> +