MDL-62889 message_popup: only add redirecturl if it exists

We allow notifications to have a null value for the 'contexturl'.
In this case we should not be appending a 'redirecturl' param to
the URL when it is going to be empty.
This commit is contained in:
Mark Nelson 2018-07-11 12:54:46 +08:00
parent b80a22f5ba
commit 38d309036c
2 changed files with 8 additions and 5 deletions

File diff suppressed because one or more lines are too long

View file

@ -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) {