MDL-62678 core: Improve efficiency of notifications and avoid ajax call

This commit is contained in:
Brendan Heywood
2020-09-30 13:55:30 +10:00
parent e049d30613
commit f3844e595e
6 changed files with 16 additions and 13 deletions
+2 -1
View File
@@ -58,7 +58,8 @@ class notification {
public static function add($message, $level = null) {
global $PAGE, $SESSION;
if ($PAGE && $PAGE->state === \moodle_page::STATE_IN_BODY) {
if ($PAGE && ($PAGE->state === \moodle_page::STATE_IN_BODY
|| $PAGE->state === \moodle_page::STATE_DONE)) {
// Currently in the page body - just render and exit immediately.
// We insert some code to immediately insert this into the user-notifications created by the header.
$id = uniqid();