Merge branch 'MDL-65344_master' of git://github.com/markn86/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2019-06-05 21:06:15 +02:00
commit e867ffd689
3 changed files with 22 additions and 3 deletions

View File

@ -2386,10 +2386,14 @@ class api {
public static function get_conversation_between_users(array $userids) {
global $DB;
$conversations = self::get_individual_conversations_between_users([$userids]);
$conversation = $conversations[0];
if (empty($userids)) {
return false;
}
if ($conversation) {
$hash = helper::get_conversation_hash($userids);
if ($conversation = $DB->get_record('message_conversations', ['type' => self::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL,
'convhash' => $hash])) {
return $conversation->id;
}
@ -2415,12 +2419,16 @@ class api {
*
* Where null is returned for the pairing of [3, 4] since no record exists.
*
* @deprecated since 3.8
* @param array $useridsets An array of arrays where the inner array is the set of user ids
* @return stdClass[] Array of conversation records
*/
public static function get_individual_conversations_between_users(array $useridsets) : array {
global $DB;
debugging('\core_message\api::get_individual_conversations_between_users is deprecated and no longer used',
DEBUG_DEVELOPER);
if (empty($useridsets)) {
return [];
}

View File

@ -5749,6 +5749,7 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
*/
public function test_get_individual_conversations_between_users_no_user_sets() {
$this->assertEmpty(\core_message\api::get_individual_conversations_between_users([]));
$this->assertDebuggingCalled();
}
/**
@ -5763,6 +5764,7 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
[null],
\core_message\api::get_individual_conversations_between_users([[$user1->id, $user2->id]])
);
$this->assertDebuggingCalled();
}
/**
@ -5783,6 +5785,7 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
[$user2->id, $user3->id],
[$user1->id, $user3->id]
]);
$this->assertDebuggingCalled();
$result = array_map(function($result) {
if ($result) {
@ -5817,6 +5820,7 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
[$user2->id, $user3->id],
[$user1->id, $user3->id]
]);
$this->assertDebuggingCalled();
$result = array_map(function($result) {
if ($result) {
@ -5851,6 +5855,7 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
[$user2->id, $user3->id],
[$user1->id, $user3->id]
]);
$this->assertDebuggingCalled();
$result = array_map(function($result) {
if ($result) {
@ -5870,6 +5875,7 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
[$user1->id, $user2->id],
[$user1->id, $user3->id]
]);
$this->assertDebuggingCalled();
$result = array_map(function($result) {
if ($result) {

View File

@ -1,6 +1,11 @@
This files describes API changes in /message/ messaging system,
information provided here is intended especially for developers.
=== 3.8 ===
* The following methods have been deprecated and should not be used any more:
- \core_message\api::get_individual_conversations_between_users()
=== 3.7 ===
* The message/index.php page used to support viewing another user's messages (if you had the right capabilities) by