MDL-64057 core_message: return conversations with soft-deleted users

Individual conversations with a soft-deleted user (including messages)
are now displayed in the conversation listing. This brings the behaviour
of individual conversations in line with group conversations, in that
the active user can still view messages.
This commit is contained in:
Jake Dallimore
2018-11-23 11:02:20 +08:00
parent b694b9b8e2
commit 0847aa120c
4 changed files with 34 additions and 29 deletions
+3 -4
View File
@@ -730,12 +730,11 @@ class api {
// Now, create the final return structure.
$arrconversations = [];
foreach ($conversations as $conversation) {
// Do not include any individual conversation which:
// a) Contains a deleted member or
// b) Does not contain a recent message for the user (this happens if the user has deleted all messages).
// Do not include any individual conversations which do not contain a recent message for the user.
// This happens if the user has deleted all messages.
// Group conversations with deleted users or no messages are always returned.
if ($conversation->conversationtype == self::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL
&& (isset($deletedmembers[$conversation->id]) || empty($conversation->messageid))) {
&& (empty($conversation->messageid))) {
continue;
}