From e5f919e07a721e7a2d977946af729a3ebc56e92c Mon Sep 17 00:00:00 2001 From: Suhaib Al-Absi Date: Wed, 19 Nov 2025 12:50:55 +0300 Subject: [PATCH 1/2] =?UTF-8?q?Fixes=20issue=20of=20hiding=20=E2=80=9CView?= =?UTF-8?q?=20Discussion=E2=80=9D=20button=20on=20Assignment=20Details=20p?= =?UTF-8?q?age=20when=20discussion=20is=20closed=20for=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs: MBL-19501 affects: Student builds: Student release note: Fixed issue of hiding “View Discussion” button on Assignment Details page when discussion is closed for comments --- .../AssignmentDetails/StudentAssignmentDetailsPresenter.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Student/Student/Assignments/AssignmentDetails/StudentAssignmentDetailsPresenter.swift b/Student/Student/Assignments/AssignmentDetails/StudentAssignmentDetailsPresenter.swift index 4fb4756b41..cbf12c0442 100644 --- a/Student/Student/Assignments/AssignmentDetails/StudentAssignmentDetailsPresenter.swift +++ b/Student/Student/Assignments/AssignmentDetails/StudentAssignmentDetailsPresenter.swift @@ -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 || From 1903b91f7ff86cf62b3e39bba739415ef50b4c1e Mon Sep 17 00:00:00 2001 From: Suhaib Al-Absi Date: Wed, 19 Nov 2025 13:04:57 +0300 Subject: [PATCH 2/2] Unit tests --- .../StudentAssignmentDetailsPresenterTests.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Student/StudentUnitTests/Assignments/AssignmentDetails/StudentAssignmentDetailsPresenterTests.swift b/Student/StudentUnitTests/Assignments/AssignmentDetails/StudentAssignmentDetailsPresenterTests.swift index 9b9a8e51cc..9afcaf476f 100644 --- a/Student/StudentUnitTests/Assignments/AssignmentDetails/StudentAssignmentDetailsPresenterTests.swift +++ b/Student/StudentUnitTests/Assignments/AssignmentDetails/StudentAssignmentDetailsPresenterTests.swift @@ -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))