properly unlock locked discussions with a lock_at time.
fixes CNVS-6762 test plan: * create a discussion with a lock_at in the past; * navigate to the discussion index page and drag the discussion from "closed for comments" to "discussions;" * refresh the page and verify that the topic remains unlocked. Change-Id: I35c819895d41e6f0f70a76c0e8805b963ff41a9e Reviewed-on: https://gerrit.instructure.com/22111 Tested-by: Jenkins <jenkins@instructure.com> QA-Review: Zach Pendleton <zachp@instructure.com> Reviewed-by: Mark Ericksen <marke@instructure.com> Product-Review: Mark Ericksen <marke@instructure.com>
This commit is contained in:
parent
c3c86cfe1a
commit
71450c6c41
|
@ -487,8 +487,9 @@ class DiscussionTopicsController < ApplicationController
|
|||
# Handle locking/unlocking (overrides workflow state if provided). It appears that the locked param as a hash
|
||||
# is from old code and is not being used. Verification requested.
|
||||
elsif params.has_key?(:locked) && !params[:locked].is_a?(Hash)
|
||||
@topic.delayed_post_at = ''
|
||||
@topic.lock_at = ''
|
||||
discussion_topic_hash[:delayed_post_at] = nil
|
||||
discussion_topic_hash[:lock_at] = nil
|
||||
|
||||
if value_to_boolean(params[:locked])
|
||||
@topic.lock
|
||||
else
|
||||
|
|
|
@ -307,4 +307,20 @@ describe DiscussionTopicsController do
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
describe "PUT: update" do
|
||||
before(:each) do
|
||||
course_with_teacher_logged_in(active_all: true)
|
||||
@topic = DiscussionTopic.create!(context: @course, title: 'Test Topic',
|
||||
lock_at: '2013-01-01T00:00:00UTC', locked: true)
|
||||
end
|
||||
|
||||
it "should unlock discussions with a lock_at attribute" do
|
||||
put('update', course_id: @course.id, topic_id: @topic.id,
|
||||
title: 'Updated Topic', format: 'json', lock_at: @topic.lock_at,
|
||||
locked: false)
|
||||
|
||||
@topic.reload.should_not be_locked
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue