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-17 11:44:41 +08:00
parent 8c51626841
commit d2eb1ca91e
2 changed files with 8 additions and 5 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.
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) {