From ef2bce431e271c0107830d68fcc3538c142a94bd Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Tue, 14 Oct 2025 14:44:18 +0200 Subject: [PATCH] MDL-86912 assign: Adjust display of Status column in Overview --- mod/assign/classes/courseformat/overview.php | 5 +---- mod/assign/tests/courseformat/overview_test.php | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mod/assign/classes/courseformat/overview.php b/mod/assign/classes/courseformat/overview.php index e06e455bbe7..77d63d8a8d4 100644 --- a/mod/assign/classes/courseformat/overview.php +++ b/mod/assign/classes/courseformat/overview.php @@ -162,10 +162,7 @@ class overview extends \core_courseformat\activityoverviewbase { private function get_extra_submission_status_overview(): ?overviewitem { global $USER; - if ( - !has_capability('mod/assign:submit', $this->context) - || has_capability('moodle/site:config', $this->context) - ) { + if (!has_capability('mod/assign:submit', $this->context, $USER, false)) { return null; } diff --git a/mod/assign/tests/courseformat/overview_test.php b/mod/assign/tests/courseformat/overview_test.php index 7ce7bf87be0..2c2839e3c2b 100644 --- a/mod/assign/tests/courseformat/overview_test.php +++ b/mod/assign/tests/courseformat/overview_test.php @@ -258,6 +258,10 @@ final class overview_test extends \advanced_testcase { $method->setAccessible(true); $item = $method->invoke($overview); $this->assertNull($item); + // Unless the admin is enrolled as a student. + $this->getDataGenerator()->enrol_user(get_admin()->id, $course->id, 'student'); + $item = $method->invoke($overview); + $this->assertEquals(get_string('submissionstatus', 'assign'), $item->get_name()); // Check student see the new status. $this->setUser($student);