announcements: remove delayed posting date if delay unchecked
fixes CNVS-7343 test plan: * create a discussion topic with a delayed posting date * edit the topic, uncheck delay, and save * verify that the topic is no longer delayed Change-Id: Iaaba7c2bdfbd1e8ce196c937d4917fc2470cbb6c Reviewed-on: https://gerrit.instructure.com/23957 QA-Review: Cam Theriault <cam@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Zach Pendleton <zachp@instructure.com> Product-Review: Zach Pendleton <zachp@instructure.com>
This commit is contained in:
parent
13af013a8e
commit
66cc6aadbc
|
@ -202,6 +202,8 @@ htmlEscape, DiscussionTopic, Announcement, Assignment, $, preventDefault, Missin
|
|||
)
|
||||
|
||||
validateBeforeSave: (data, errors) =>
|
||||
if data.delay_posting == "0"
|
||||
data.delayed_post_at = null
|
||||
if @isTopic() && data.set_assignment is '1'
|
||||
if @assignmentGroupSelector?
|
||||
errors = @assignmentGroupSelector.validateBeforeSave(data, errors)
|
||||
|
|
|
@ -284,6 +284,18 @@ describe "announcements" do
|
|||
f('.discussion-fyi').should include_text('This topic will not be visible')
|
||||
end
|
||||
|
||||
it "should remove delayed_post_at when unchecking delay_posting" do
|
||||
topic = announcement_model(:title => @topic_title, :user => @user, :delayed_post_at => 10.days.ago)
|
||||
get "/courses/#{@course.id}/announcements/#{topic.id}"
|
||||
expect_new_page_load { f(".edit-btn").click }
|
||||
|
||||
f('input[type=checkbox][name="delay_posting"]').click
|
||||
expect_new_page_load { f('.form-actions button[type=submit]').click }
|
||||
|
||||
topic.reload
|
||||
topic.delayed_post_at.should be_nil
|
||||
end
|
||||
|
||||
it "should have a teacher add a new entry to its own announcement" do
|
||||
pending "delayed jobs"
|
||||
create_announcement
|
||||
|
|
Loading…
Reference in New Issue