From 89460a50d2053f870c546d5ec0a2e073369d4d63 Mon Sep 17 00:00:00 2001 From: Mathew May Date: Tue, 24 Aug 2021 23:41:09 +0800 Subject: [PATCH] MDL-69588 navigation: Address final point from review --- lib/classes/navigation/views/secondary.php | 11 +++++++---- mod/workshop/tests/behat/behat_mod_workshop.php | 2 +- theme/boost/classes/boostnavbar.php | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/classes/navigation/views/secondary.php b/lib/classes/navigation/views/secondary.php index e545e7f6054..e28655811f6 100644 --- a/lib/classes/navigation/views/secondary.php +++ b/lib/classes/navigation/views/secondary.php @@ -206,10 +206,13 @@ class secondary extends view { $nodesordered += $this->get_leaf_nodes($navigation, $nodes['navigation'] ?? []); $this->add_ordered_nodes($nodesordered); - // All additional nodes will be available under the 'Course admin' page. - $text = get_string('courseadministration'); - $url = new \moodle_url('/course/admin.php', array('courseid' => $this->page->course->id)); - $this->add($text, $url, null, null, 'courseadmin', new \pix_icon('t/edit', $text)); + $coursecontext = \context_course::instance($course->id); + if (has_capability('moodle/course:update', $coursecontext)) { + // All additional nodes will be available under the 'Course admin' page. + $text = get_string('courseadministration'); + $url = new \moodle_url('/course/admin.php', array('courseid' => $this->page->course->id)); + $this->add($text, $url, null, null, 'courseadmin', new \pix_icon('t/edit', $text)); + } } /** diff --git a/mod/workshop/tests/behat/behat_mod_workshop.php b/mod/workshop/tests/behat/behat_mod_workshop.php index 51c1633d2b9..d02ce953265 100644 --- a/mod/workshop/tests/behat/behat_mod_workshop.php +++ b/mod/workshop/tests/behat/behat_mod_workshop.php @@ -90,7 +90,7 @@ class behat_mod_workshop extends behat_base { * @param TableNode $table data to fill the submission form with, must contain 'Title' */ public function i_edit_assessment_form_in_workshop_as($workshopname, $table) { - $this->execute("behat_navigation::go_to_breadcrumb_location", $workshopname); + $this->execute("behat_navigation::i_am_on_page_instance", [$this->escape($workshopname), 'workshop activity']); $this->execute('behat_navigation::i_navigate_to_in_current_page_administration', get_string('editassessmentform', 'workshop')); diff --git a/theme/boost/classes/boostnavbar.php b/theme/boost/classes/boostnavbar.php index 19507ba8eb8..30dc2f95262 100644 --- a/theme/boost/classes/boostnavbar.php +++ b/theme/boost/classes/boostnavbar.php @@ -56,7 +56,8 @@ class boostnavbar implements \renderable { // Set the designated one path for courses. $mycoursesnode = $this->get_item('mycourses'); if (!is_null($mycoursesnode)) { - $url = new \moodle_url('/mycourses/'); + // TODO: Once MDL-70801 lands point this to the new page. + $url = new \moodle_url('/course/'); $mycoursesnode->action = $url; $mycoursesnode->text = get_string('courses'); } -- 2.11.4.GIT