Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ class StudentAssignmentDetailsPresenter {
return false
}

// Always show "View Discussion" button for graded discussions
if assignment?.isDiscussion == true { return false }

return assignment?.lockStatus != .unlocked ||
assignment?.lockedForUser == true ||
assignment?.isSubmittable == false ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,22 @@ class StudentAssignmentDetailsPresenterTests: StudentTestCase {
XCTAssertTrue( presenter.submitAssignmentButtonIsHidden() )
}

func testSubmitAssignmentButtonIsNotHiddenForClosedForCommentsDiscussion() {
Assignment.make(from: .make(
can_submit: false,
locked_for_user: true,
lock_at: Date().addDays(-3),
lock_explanation: "closed for comments",
submission_types: [ .discussion_topic ]
))
XCTAssertFalse( presenter.submitAssignmentButtonIsHidden() )
}

func testSubmitAssignmentButtonIsNotHiddenForUnlockedDiscussion() {
Assignment.make(from: .make(submission_types: [ .discussion_topic ]))
XCTAssertFalse( presenter.submitAssignmentButtonIsHidden() )
}

func testSubmitAssignmentButtonIsNotHiddenForUnlockedQuiz() {
Assignment.make(from: .make(locked_for_user: true, quiz_id: "1"))
Quiz.make(from: .make(id: "1", locked_for_user: false))
Expand Down