Skip to content
Permalink
Browse files

Merge branch 'MDL-62889_master' of git://github.com/markn86/moodle

  • Loading branch information...
andrewnicols committed Jul 17, 2018
2 parents affd85c + b77e584 commit 9e52f4adc2666e667a46e16a0200f6440b1af410

Some generated files are not rendered by default. Learn more.

@@ -223,10 +223,13 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str', 'core/url',
});

// Link to mark read page before loading the actual link.
notification.contexturl = URL.relativeUrl('message/output/popup/mark_notification_read.php', {
notificationid: notification.id,
redirecturl: notification.contexturl
});
var notificationurlparams = {
notificationid: notification.id
};
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)
.then(function(html, js) {
@@ -31,13 +31,18 @@
}
$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));
// 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.
if ($USER->id != $notification->useridto) {
redirect($CFG->wwwroot);
}
\core_message\api::mark_notification_as_read($notification);
redirect($redirecturl);
redirect(new moodle_url($redirecturl));

0 comments on commit 9e52f4a

Please sign in to comment.
You can’t perform that action at this time.