Commit 57532ad6 authored by Mark Nelson's avatar Mark Nelson
Browse files

MDL-65344 core_message: deprecate get_individual_conversations_between_users()

parent 14cdf511
......@@ -2389,10 +2389,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;
}
$hash = helper::get_conversation_hash($userids);
if ($conversation) {
if ($conversation = $DB->get_record('message_conversations', ['type' => self::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL,
'convhash' => $hash])) {
return $conversation->id;
}
......@@ -2418,12 +2422,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 [];
}
......
......@@ -5666,6 +5666,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();
}
/**
......@@ -5680,6 +5681,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();
}
/**
......@@ -5700,6 +5702,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) {
......@@ -5734,6 +5737,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) {
......@@ -5768,6 +5772,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) {
......@@ -5787,6 +5792,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) {
......
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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment