Merge branch 'MDL-66237-37' of git://github.com/mickhawkins/moodle into MOODLE_37_STABLE

This commit is contained in:
Adrian Greeve
2020-01-21 11:24:01 +08:00
3 changed files with 7 additions and 7 deletions
File diff suppressed because one or more lines are too long
@@ -226,9 +226,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str', 'core/url',
var notificationurlparams = {
notificationid: notification.id
};
if (notification.contexturl) {
notificationurlparams.redirecturl = encodeURIComponent(notification.contexturl);
}
notification.contexturl = URL.relativeUrl('message/output/popup/mark_notification_read.php', notificationurlparams);
var promise = Templates.render('message_popup/notification_content_item', notification)
@@ -31,11 +31,13 @@ if (isguestuser()) {
}
$notificationid = required_param('notificationid', PARAM_INT);
$redirecturl = optional_param('redirecturl', '', PARAM_URL);
$notification = $DB->get_record('notifications', array('id' => $notificationid));
// If the redirect URL after filtering is empty, or it was never passed, then redirect to the notification page.
if (empty($redirecturl)) {
if (!empty($notification->contexturl)) {
$redirecturl = new moodle_url($notification->contexturl);
} else {
$redirecturl = new moodle_url('/message/output/popup/notifications.php', ['notificationid' => $notificationid]);
}
@@ -45,4 +47,4 @@ if ($USER->id != $notification->useridto) {
}
\core_message\api::mark_notification_as_read($notification);
redirect(new moodle_url($redirecturl));
redirect($redirecturl);