mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-66237 message_popup: Get redirecturl from notification contexturl
This commit is contained in:
parent
c55402486b
commit
8725ac5f42
File diff suppressed because one or more lines are too long
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user