generic message for max_per_day setting
This commit is contained in:
@@ -15,7 +15,7 @@ class DirectMessage < ActiveRecord::Base
|
|||||||
max = Setting[:direct_message_max_per_day]
|
max = Setting[:direct_message_max_per_day]
|
||||||
|
|
||||||
if sender.direct_messages_sent.today.count >= max.to_i
|
if sender.direct_messages_sent.today.count >= max.to_i
|
||||||
errors.add(:title, I18n.t('activerecord.errors.models.direct_message.attributes.max_per_day.invalid', max: max))
|
errors.add(:title, I18n.t('activerecord.errors.models.direct_message.attributes.max_per_day.invalid'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ en:
|
|||||||
direct_message:
|
direct_message:
|
||||||
attributes:
|
attributes:
|
||||||
max_per_day:
|
max_per_day:
|
||||||
invalid: "You can only send a maximum of %{max} direct messages per day"
|
invalid: "You have reached the maximum number of private messages per day"
|
||||||
proposal:
|
proposal:
|
||||||
attributes:
|
attributes:
|
||||||
tag_list:
|
tag_list:
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ es:
|
|||||||
direct_message:
|
direct_message:
|
||||||
attributes:
|
attributes:
|
||||||
max_per_day:
|
max_per_day:
|
||||||
invalid: "Sólo puedes enviar %{max} mensajes directos por día"
|
invalid: "Has llegado al número máximo de mensajes privados por día"
|
||||||
proposal:
|
proposal:
|
||||||
attributes:
|
attributes:
|
||||||
tag_list:
|
tag_list:
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ feature 'Direct messages' do
|
|||||||
fill_in 'direct_message_body', with: "How are you doing?"
|
fill_in 'direct_message_body', with: "How are you doing?"
|
||||||
click_button "Send message"
|
click_button "Send message"
|
||||||
|
|
||||||
expect(page).to have_content "You can only send a maximum of 3 direct messages per day"
|
expect(page).to have_content "You have reached the maximum number of private messages per day"
|
||||||
expect(page).to_not have_content "You message has been sent successfully."
|
expect(page).to_not have_content "You message has been sent successfully."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user