Merge branch 'MDL-63915_master' of git://github.com/markn86/moodle
[moodle.git] / message / classes / api.php
index b581931..b15a97e 100644 (file)
@@ -711,6 +711,13 @@ class api {
                             $members[$convid][$key]->canmessage = null;
                             $members[$convid][$key]->contactrequests = [];
                         }
+                    } else { // Remove all members and individual conversations where we could not get the member's information.
+                        unset($members[$convid][$key]);
+
+                        // If the conversation is an individual conversation, then we should remove it from the list.
+                        if ($conversations[$convid]->conversationtype == self::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL) {
+                            unset($conversations[$convid]);
+                        }
                     }
                 }
             }