mirror of
https://github.com/moodle/moodle.git
synced 2025-08-11 20:06:46 +02:00
Merge branch 'MDL-62889_35' of git://github.com/markn86/moodle into MOODLE_35_STABLE
This commit is contained in:
commit
c2c97dee39
3 changed files with 15 additions and 7 deletions
File diff suppressed because one or more lines are too long
|
@ -223,10 +223,13 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str', 'core/url',
|
||||||
});
|
});
|
||||||
|
|
||||||
// Link to mark read page before loading the actual link.
|
// Link to mark read page before loading the actual link.
|
||||||
notification.contexturl = URL.relativeUrl('message/output/popup/mark_notification_read.php', {
|
var notificationurlparams = {
|
||||||
notificationid: notification.id,
|
notificationid: notification.id
|
||||||
redirecturl: notification.contexturl
|
};
|
||||||
});
|
if (notification.contexturl) {
|
||||||
|
notificationurlparams.redirecturl = notification.contexturl;
|
||||||
|
}
|
||||||
|
notification.contexturl = URL.relativeUrl('message/output/popup/mark_notification_read.php', notificationurlparams);
|
||||||
|
|
||||||
var promise = Templates.render('message_popup/notification_content_item', notification)
|
var promise = Templates.render('message_popup/notification_content_item', notification)
|
||||||
.then(function(html, js) {
|
.then(function(html, js) {
|
||||||
|
|
|
@ -31,13 +31,18 @@ if (isguestuser()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$notificationid = required_param('notificationid', PARAM_INT);
|
$notificationid = required_param('notificationid', PARAM_INT);
|
||||||
$redirecturl = optional_param('redirecturl', $CFG->wwwroot, PARAM_LOCALURL);
|
$redirecturl = optional_param('redirecturl', '', PARAM_URL);
|
||||||
$notification = $DB->get_record('notifications', array('id' => $notificationid));
|
$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)) {
|
||||||
|
$redirecturl = new moodle_url('/message/output/popup/notifications.php', ['notificationid' => $notificationid]);
|
||||||
|
}
|
||||||
|
|
||||||
// Check notification belongs to this user.
|
// Check notification belongs to this user.
|
||||||
if ($USER->id != $notification->useridto) {
|
if ($USER->id != $notification->useridto) {
|
||||||
redirect($CFG->wwwroot);
|
redirect($CFG->wwwroot);
|
||||||
}
|
}
|
||||||
|
|
||||||
\core_message\api::mark_notification_as_read($notification);
|
\core_message\api::mark_notification_as_read($notification);
|
||||||
redirect($redirecturl);
|
redirect(new moodle_url($redirecturl));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue