check .draft_state_enabled? on correct context in assignments api
fixes CNVS-9059 test plan: - disable draft state in the console - turn on draft state in the account and course settings - create a new assignment - go to the course assignments page - click the cloud next to the assignment to publish - refresh the page, it should still be published Change-Id: Iddb633b4785a3343594bd64459aa245e991fb234 Reviewed-on: https://gerrit.instructure.com/25720 QA-Review: Matt Fairbourn <mfairbourn@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Cameron Sutter <csutter@instructure.com> Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
parent
de32c0405b
commit
9cff91dcac
|
@ -167,8 +167,7 @@ module Api::V1::Assignment
|
|||
hash['module_ids'] = module_ids
|
||||
end
|
||||
|
||||
#show published/unpublished if account.settings[:enable_draft]
|
||||
if @domain_root_account.enable_draft?
|
||||
if assignment.context.draft_state_enabled?
|
||||
hash['published'] = ! assignment.unpublished?
|
||||
hash['unpublishable'] = !assignment.has_student_submissions?
|
||||
end
|
||||
|
@ -324,7 +323,7 @@ module Api::V1::Assignment
|
|||
update_params["description"] = process_incoming_html_content(update_params["description"])
|
||||
end
|
||||
|
||||
if @domain_root_account.enable_draft?
|
||||
if assignment.context.draft_state_enabled?
|
||||
if assignment_params.has_key? "published"
|
||||
published = value_to_boolean(assignment_params['published'])
|
||||
assignment.workflow_state = published ? 'published' : 'unpublished'
|
||||
|
|
|
@ -42,7 +42,7 @@ module Api::V1::AssignmentGroup
|
|||
# fake assignment used for checking if the @current_user can read unpublished assignments
|
||||
fake = group.context.assignments.new
|
||||
fake.workflow_state = 'unpublished'
|
||||
if @domain_root_account.enable_draft? && !fake.grants_right?(user, session, :read)
|
||||
if group.context.draft_state_enabled? && !fake.grants_right?(user, session, :read)
|
||||
# user should not see unpublished assignments
|
||||
assignment_scope = assignment_scope.published
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue