MDL-73066 calendar: remove course and cat params from footer links

This commit is contained in:
Simey Lameze
2021-11-23 19:11:34 +08:00
parent 16a5169a43
commit dba805c552
4 changed files with 15 additions and 34 deletions
@@ -41,12 +41,12 @@ Feature: Enable the calendar block in a course and test it's functionality
@javascript
Scenario: View a course event in the calendar block
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Calendar" block
And I create a calendar event with form data:
| id_eventtype | Course |
| id_name | Course Event |
When I am on "Course 1" course homepage
| Type of event | course |
| Course | Course 1 |
| Event title | Course Event |
When I am on "Course 1" course homepage with editing mode on
And I add the "Calendar" block
And I hover over today in the mini-calendar block
Then I should see "Course Event"
+1 -23
View File
@@ -82,28 +82,12 @@ class footer_options_exporter extends exporter {
*/
protected function get_manage_subscriptions_link(): ?string {
if (calendar_user_can_add_event($this->calendar->course)) {
$managesubscriptionurl = new moodle_url('/calendar/managesubscriptions.php', $this->get_link_params());
$managesubscriptionurl = new moodle_url('/calendar/managesubscriptions.php');
return $managesubscriptionurl->out(true);
}
return null;
}
/**
* Get the list of URL parameters for calendar links.
*
* @return array
*/
protected function get_link_params() {
$params = [];
if (SITEID !== $this->calendar->course->id) {
$params['course'] = $this->calendar->course->id;
} else if (null !== $this->calendar->categoryid && $this->calendar->categoryid > 0) {
$params['category'] = $this->calendar->categoryid;
}
return $params;
}
/**
* Get the additional values to inject while exporting.
*
@@ -166,12 +150,6 @@ class footer_options_exporter extends exporter {
'time' => $this->calendar->time,
]);
if ($this->calendar->course && SITEID !== $this->calendar->course->id) {
$url->param('course', $this->calendar->course->id);
} else if ($this->calendar->categoryid) {
$url->param('category', $this->calendar->categoryid);
}
return $url->out(false);
}
}
+8 -6
View File
@@ -73,8 +73,9 @@ Feature: Perform basic calendar functionality
@javascript
Scenario: Create a group event
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I create a calendar event with form data:
And I follow "Full calendar"
And I set the field "course" to "C1"
And I create a calendar event:
| Type of event | group |
| Group | Group 1 |
| Event title | Really awesome event! |
@@ -139,12 +140,13 @@ Feature: Perform basic calendar functionality
@javascript
Scenario: Module events editing
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And the following "activities" exist:
| activity | course | idnumber | name | intro | timeopen | timeclose |
| choice | C1 | choice1 | Test choice | Test choice description | ##today## | ##today## |
When I follow "Full calendar"
And I set the field "course" to "C1"
Then I should see "Test choice opens"
And I should see "Test choice closes"
When I click on "Test choice opens" "link"
@@ -186,8 +188,8 @@ Feature: Perform basic calendar functionality
When I am viewing site calendar
And I click on "New event" "button"
Then the field "Type of event" matches value "User"
And I am on "Course 1" course homepage
And I follow "Full calendar"
And I click on "Close" "button"
And I set the field "course" to "C1"
When I click on "New event" "button"
Then the field "Type of event" matches value "Course"
@@ -25,6 +25,7 @@ Feature: Limit displayed upcoming events
And I click on "a.next" "css_element"
When I create a calendar event:
| Type of event | course |
| Course | Course 1 |
| Event title | Two months away event |
And I am on "Course 1" course homepage
Then I should not see "Two months away event"