Skip to content

Commit fbae29b

Browse files
committed
fixed lack of validation rules passed to comment reply textarea
1 parent 67321e8 commit fbae29b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

app/views/comments/_reply_to_thread.html.erb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
%>
1111

1212
<%
13+
# TODO: make configurable
14+
min_chars = 15
15+
max_chars = 1000
16+
1317
can_comment = user.can_reply_to?(thread)
1418
is_rate_limited, rate_limit_message = comment_rate_limited?(user, post, create_audit_log: false)
1519
text ||= defined?(text) && text.present? ? text : t('comments.labels.reply_to_thread')
@@ -46,10 +50,13 @@
4650
<%= label_tag :content, 'Your message', class: 'form-element' %>
4751
<%= text_area_tag :content, '',
4852
class: 'form-element js-comment-field',
53+
minlength: min_chars,
54+
maxlength: max_chars,
55+
required: true,
4956
data: { thread: thread.id,
5057
post: thread.post_id,
5158
character_count: ".js-character-count-#{post.id}" } %>
52-
<%= render 'shared/char_count', type: post.id, min: 15, max: 1000 %>
59+
<%= render 'shared/char_count', type: post.id, min: min_chars, max: max_chars %>
5360
<%= submit_tag 'Add reply', class: 'button is-muted is-filled', disabled:true %>
5461
<% end %>
5562
<% end %>

0 commit comments

Comments
 (0)