From 77e5b4462e795d1710ccecc0f1ecb0cc7f03dac1 Mon Sep 17 00:00:00 2001 From: Bas Brands Date: Mon, 27 Jan 2020 12:14:16 +0100 Subject: [PATCH] MDL-67577 core_message: navbar_output order * moved the logic from core_message_popup_render_navbar_output to message_popup_render_navbar_output in message/output/popup/lib.php * using float: left instead of float: right in theme --- message/lib.php | 33 ---------------------- message/output/popup/lib.php | 11 ++++++++ message/templates/message_popover.mustache | 2 +- .../behat/message_drawer_manage_contacts.feature | 4 +-- theme/boost/scss/moodle/popover-region.scss | 3 +- theme/boost/style/moodle.css | 3 +- theme/classic/style/moodle.css | 3 +- 7 files changed, 17 insertions(+), 42 deletions(-) diff --git a/message/lib.php b/message/lib.php index b850e7fe7d8..b3cb81d7785 100644 --- a/message/lib.php +++ b/message/lib.php @@ -785,39 +785,6 @@ function core_message_user_preferences() { } /** - * Renders the popup. - * - * @param renderer_base $renderer - * @return string The HTML - */ -function core_message_render_navbar_output(\renderer_base $renderer) { - global $USER, $CFG; - - // Early bail out conditions. - if (!isloggedin() || isguestuser() || user_not_fully_set_up($USER) || - get_user_preferences('auth_forcepasswordchange') || - (!$USER->policyagreed && !is_siteadmin() && - ($manager = new \core_privacy\local\sitepolicy\manager()) && $manager->is_defined())) { - return ''; - } - - $output = ''; - - // Add the messages popover. - if (!empty($CFG->messaging)) { - $unreadcount = \core_message\api::count_unread_conversations($USER); - $requestcount = \core_message\api::get_received_contact_requests_count($USER->id); - $context = [ - 'userid' => $USER->id, - 'unreadcount' => $unreadcount + $requestcount - ]; - $output .= $renderer->render_from_template('core_message/message_popover', $context); - } - - return $output; -} - -/** * Render the message drawer to be included in the top of the body of each page. * * @return string HTML diff --git a/message/output/popup/lib.php b/message/output/popup/lib.php index fcfb3696de7..dd3964e59bc 100644 --- a/message/output/popup/lib.php +++ b/message/output/popup/lib.php @@ -58,5 +58,16 @@ function message_popup_render_navbar_output(\renderer_base $renderer) { $output .= $renderer->render_from_template('message_popup/notification_popover', $context); } + // Add the messages popover. + if (!empty($CFG->messaging)) { + $unreadcount = \core_message\api::count_unread_conversations($USER); + $requestcount = \core_message\api::get_received_contact_requests_count($USER->id); + $context = [ + 'userid' => $USER->id, + 'unreadcount' => $unreadcount + $requestcount + ]; + $output .= $renderer->render_from_template('core_message/message_popover', $context); + } + return $output; } diff --git a/message/templates/message_popover.mustache b/message/templates/message_popover.mustache index 72e541a1da4..8f63132cfd7 100644 --- a/message/templates/message_popover.mustache +++ b/message/templates/message_popover.mustache @@ -35,7 +35,7 @@ } }} -