mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 16:41:08 +08:00
clarify copy when editing a poll after the first 5 minutes
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user