MDL-63913 core_message: fix to ensure favourites is exclusive

If a conversation is included in the favourites unread count, it
cannot be included in any other type-based counts.
This commit is contained in:
Jake Dallimore 2018-11-19 13:51:40 +08:00
parent 33022ee1d5
commit a54115355a
2 changed files with 12 additions and 6 deletions

View file

@ -2968,10 +2968,11 @@ class api {
self::MESSAGE_CONVERSATION_TYPE_GROUP => 0
]];
foreach ($unreadcounts as $convid => $info) {
$counts['types'][$info->type]++;
if (isset($favouriteconvids[$convid])) {
$counts['favourites']++;
continue;
}
$counts['types'][$info->type]++;
}
return $counts;