Fix @notification text for non visitors

This commit is contained in:
Robin Ward 2013-04-02 11:58:12 -04:00
parent 422dbbd25a
commit e8d66beea5
2 changed files with 9 additions and 3 deletions

View File

@ -124,9 +124,11 @@ class Post < ActiveRecord::Base
end end
def max_mention_validator def max_mention_validator
max_mentions = SiteSetting.visitor_max_mentions_per_post if user.present? && user.has_trust_level?(:basic)
max_mentions = SiteSetting.max_mentions_per_post if user.present? && user.has_trust_level?(:basic) errors.add(:base, I18n.t(:too_many_mentions, count: SiteSetting.max_mentions_per_post)) if raw_mentions.size > SiteSetting.max_mentions_per_post
errors.add(:base, I18n.t(:too_many_mentions, count: max_mentions)) if raw_mentions.size > max_mentions else
errors.add(:base, I18n.t(:too_many_mentions_visitor, count: SiteSetting.visitor_max_mentions_per_post)) if raw_mentions.size > SiteSetting.visitor_max_mentions_per_post
end
end end
def max_images_validator def max_images_validator

View File

@ -13,6 +13,10 @@ en:
is_reserved: "is reserved" is_reserved: "is reserved"
too_many_mentions: too_many_mentions:
zero: "Sorry, you can't mention other users."
one: "Sorry, you can only mention one other user in a post."
other: "Sorry, you can only mention %{count} users in a post."
too_many_mentions_visitor:
zero: "Sorry, visitors can't mention other users." zero: "Sorry, visitors can't mention other users."
one: "Sorry, visitors can only mention one other user in a post." one: "Sorry, visitors can only mention one other user in a post."
other: "Sorry, visitors can only mention %{count} users in a post." other: "Sorry, visitors can only mention %{count} users in a post."