FIX: allows polls on closed topics

This commit is contained in:
Régis Hanol
2016-03-21 12:12:25 +01:00
parent e8aaa6d59e
commit b575f97ece
3 changed files with 12 additions and 15 deletions

View File

@ -54,8 +54,8 @@ after_initialize do
raise StandardError.new I18n.t("poll.post_is_deleted")
end
# topic must be open
if post.topic.try(:closed) || post.topic.try(:archived)
# topic must not be archived
if post.topic.try(:archived)
raise StandardError.new I18n.t("poll.topic_must_be_open_to_vote")
end
@ -107,8 +107,8 @@ after_initialize do
raise StandardError.new I18n.t("poll.post_is_deleted")
end
# topic must be open
if post.topic.try(:closed) || post.topic.try(:archived)
# topic must not be archived
if post.topic.try(:archived)
raise StandardError.new I18n.t("poll.topic_must_be_open_to_toggle_status")
end