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.
Remove AJAX requests core_message_get_unread_conversations_count and
message_popup_get_unread_popup_notification_count and
render the unread messages and notifications into mustache template.
Before this change the messages in the message popup would be loaded
onto a page in a random order, based on the speed at which the user's
browser was able to render each template.
This causes the messages to be attached to the page sequentially, after
they have all been rendered asynchronously.
Previously there were a few issues with the code
* We were capturing a promise without then then .then() that came after
it, so our promise wouldn't always be completely resolved by the time
then next piece of code was operating on it
* We weren't catching all errors with .catch()