Give a better error message from the server if you've been replying too much.
This commit is contained in:
parent
ec10575a9e
commit
14ec64a36a
|
@ -27,7 +27,9 @@ en:
|
||||||
site_under_maintenance: 'Site is currently undergoing maintenance.'
|
site_under_maintenance: 'Site is currently undergoing maintenance.'
|
||||||
operation_already_running: "An %{operation} is currently running. Can't start a new %{operation} job right now."
|
operation_already_running: "An %{operation} is currently running. Can't start a new %{operation} job right now."
|
||||||
|
|
||||||
too_many_replies: "Sorry you can't reply any more times in that topic."
|
too_many_replies:
|
||||||
|
one: "We're sorry, but new users are temporarily limited to 1 reply in the same topic."
|
||||||
|
other: "We're sorry, but new users are temporarily limited to %{count} replies in the same topic."
|
||||||
|
|
||||||
embed:
|
embed:
|
||||||
start_discussion: "Begin the Discussion"
|
start_discussion: "Begin the Discussion"
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Validators::PostValidator < ActiveModel::Validator
|
||||||
|
|
||||||
def max_posts_validator(post)
|
def max_posts_validator(post)
|
||||||
if post.new_record? && post.acting_user.present? && post.acting_user.posted_too_much_in_topic?(post.topic_id)
|
if post.new_record? && post.acting_user.present? && post.acting_user.posted_too_much_in_topic?(post.topic_id)
|
||||||
post.errors.add(:base, I18n.t(:too_many_replies))
|
post.errors.add(:base, I18n.t(:too_many_replies, count: SiteSetting.newuser_max_replies_per_topic))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue