1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-23 09:23:09 +02:00

MDL-64058 core_message: add unread counts to the conversations view

This commit is contained in:
Jake Dallimore 2018-11-19 11:56:37 +08:00
parent a54115355a
commit da714be155

@ -866,6 +866,9 @@ function core_message_standard_after_main_region_html() {
// Enter to send.
$entertosend = get_user_preferences('message_entertosend', false, $USER);
// Get the unread counts for the current user.
$unreadcounts = \core_message\api::get_unread_conversation_counts($USER->id);
return $renderer->render_from_template('core_message/message_drawer', [
'contactrequestcount' => $requestcount,
'loggedinuser' => [
@ -876,7 +879,7 @@ function core_message_standard_after_main_region_html() {
'messages' => [
'expanded' => empty($favouriteconversationcount) && empty($groupconversationcount),
'count' => [
'unread' => 0, // TODO: fix me.
'unread' => $unreadcounts['types'][\core_message\api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL],
'total' => $individualconversationcount
],
'placeholders' => array_fill(0, $individualconversationcount, true)
@ -884,7 +887,7 @@ function core_message_standard_after_main_region_html() {
'groupmessages' => [
'expanded' => empty($favouriteconversationcount) && !empty($groupconversationcount),
'count' => [
'unread' => 0, // TODO: fix me.
'unread' => $unreadcounts['types'][\core_message\api::MESSAGE_CONVERSATION_TYPE_GROUP],
'total' => $groupconversationcount
],
'placeholders' => array_fill(0, $groupconversationcount, true)
@ -892,7 +895,7 @@ function core_message_standard_after_main_region_html() {
'favourites' => [
'expanded' => !empty($favouriteconversationcount),
'count' => [
'unread' => 0, // TODO: fix me.
'unread' => $unreadcounts['favourites'],
'total' => $favouriteconversationcount
],
'placeholders' => array_fill(0, $favouriteconversationcount, true)