clarify copy when editing a poll after the first 5 minutes

This commit is contained in:
Régis Hanol
2015-05-07 17:24:35 +02:00
parent 9b0ca60f52
commit c1bb7bc7cc
3 changed files with 10 additions and 8 deletions

View File

@ -260,10 +260,10 @@ after_initialize do
if polls.keys != previous_polls.keys ||
polls.values.map { |p| p["options"] } != previous_polls.values.map { |p| p["options"] }
# outside the 5-minute edit window?
# outside of the 5-minute edit window?
if post.created_at < 5.minutes.ago
# cannot add/remove/change/re-order polls
if polls.keys != previous_polls.keys
# cannot add/remove/rename polls
if polls.keys.sort != previous_polls.keys.sort
post.errors.add(:base, I18n.t("poll.cannot_change_polls_after_5_minutes"))
return
end
@ -278,8 +278,8 @@ after_initialize do
end
end
else
# OP cannot change polls
post.errors.add(:base, I18n.t("poll.cannot_change_polls_after_5_minutes"))
# OP cannot edit poll options
post.errors.add(:base, I18n.t("poll.op_cannot_edit_options_after_5_minutes"))
return
end
end