Skip to content

Commit

Permalink
MDL-67208 calendar: fix manage subscription redirection
Browse files Browse the repository at this point in the history
This patch fix the subcription page only adding the course parameter
only when viewing the calendar on course context. It also passes the
url to the form instance, so we have the course parameter on the
form action attribute.
  • Loading branch information
lameze committed Jun 24, 2021
1 parent 10daae7 commit 0990246
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions calendar/managesubscriptions.php
Expand Up @@ -37,7 +37,7 @@
$action = optional_param('action', '', PARAM_INT);

$url = new moodle_url('/calendar/managesubscriptions.php');
if ($courseid != SITEID) {
if ($courseid != SITEID && !empty($courseid)) {
$url->param('course', $courseid);
}
if ($categoryid) {
Expand Down Expand Up @@ -77,7 +77,7 @@
'courseid' => $course->id,
'groups' => $groups,
];
$form = new \core_calendar\local\event\forms\managesubscriptions(null, $customdata);
$form = new \core_calendar\local\event\forms\managesubscriptions($url, $customdata);
$form->set_data(array(
'course' => $course->id
));
Expand Down
2 changes: 1 addition & 1 deletion calendar/renderer.php
Expand Up @@ -374,7 +374,7 @@ public function subscription_details($unused = null, $subscriptions, $importresu
*/
protected function subscription_action_form($subscription) {
// Assemble form for the subscription row.
$html = html_writer::start_tag('form', array('action' => new moodle_url('/calendar/managesubscriptions.php'), 'method' => 'post'));
$html = html_writer::start_tag('form', ['action' => $this->page->url->out(false) , 'method' => 'post']);
if (empty($subscription->url)) {
// Don't update an iCal file, which has no URL.
$html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'pollinterval', 'value' => '0'));
Expand Down

0 comments on commit 0990246

Please sign in to comment.