MDL-65566 core_message: let get_self_conversation use lazy init too

This commit is contained in:
Jake Dallimore 2019-05-15 18:28:15 +08:00
parent 510ede5698
commit 7918a0ea4c
2 changed files with 4 additions and 2 deletions

View File

@ -2454,6 +2454,7 @@ class api {
*/
public static function get_self_conversation(int $userid) {
global $DB;
self::lazy_create_self_conversation($userid);
$conditions = [
'type' => self::MESSAGE_CONVERSATION_TYPE_SELF,

View File

@ -827,8 +827,9 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
$this->assertEquals($user2->id, $member->id);
\core_message\api::delete_all_conversation_data($rsc3->id);
$rsc3 = \core_message\api::get_self_conversation($user3->id);
$this->assertFalse($rsc3);
$selfconversation = \core_message\api::get_self_conversation($user3->id);
$members = \core_message\api::get_conversation_members($user1->id, $selfconversation->id);
$this->assertCount(1, $members);
}
/**