don't error if you "close for comments" a delayed post

fixes: #10166

test plan:

create a discussion/announcement and say delay posting
till a future date.
click the "close for comments" button on
the show page
it should not have a page error

Change-Id: I8ddba899b1b832824bdcd4d83b6b31cb407acabf
Reviewed-on: https://gerrit.instructure.com/13220
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
This commit is contained in:
Ryan Shaw 2012-08-24 18:05:32 -06:00 committed by Jon Jensen
parent 295581a65d
commit d868f35c13
2 changed files with 5 additions and 5 deletions

View File

@ -11,11 +11,9 @@ define [
defaults:
discussion_type: 'side_comment'
delayed_post_at: null
podcast_enabled: false
podcast_has_student_posts: false
require_initial_post: false
assignment: null
is_announcement: false
dateAttributes: [

View File

@ -367,9 +367,11 @@ class DiscussionTopicsController < ApplicationController
@topic.content_being_saved_by(@current_user)
# handle delayed posting
@topic.delayed_post_at = discussion_topic_hash[:delayed_post_at]
@topic.workflow_state = 'post_delayed' if @topic.delayed_post_at && @topic.delayed_post_at > Time.now
@topic.delayed_post_at = "" unless @topic.post_delayed?
if discussion_topic_hash.has_key? :delayed_post_at
@topic.delayed_post_at = discussion_topic_hash[:delayed_post_at]
@topic.workflow_state = 'post_delayed' if @topic.delayed_post_at && @topic.delayed_post_at > Time.now
@topic.delayed_post_at = "" unless @topic.post_delayed?
end
#handle locking/unlocking
if params.has_key? :locked