MDL-63909 core_message: undeprecated still used functions by old UI
A note has been made to remove these and other functions once we remove the old UI.
This commit is contained in:
+18
-9
@@ -151,7 +151,7 @@ class api {
|
||||
/**
|
||||
* Handles searching for user in a particular course in the message area.
|
||||
*
|
||||
* TODO: This function should be removed once new group messaging UI is in place and old messaging UI is removed.
|
||||
* TODO: This function should be removed once the new group messaging UI is in place and the old messaging UI is removed.
|
||||
* For now we are not removing/deprecating this function for backwards compatibility with messaging UI.
|
||||
* But we are deprecating data_for_messagearea_search_users_in_course external function.
|
||||
* Followup: MDL-63915
|
||||
@@ -197,7 +197,7 @@ class api {
|
||||
/**
|
||||
* Handles searching for user in the message area.
|
||||
*
|
||||
* TODO: This function should be removed once new group messaging UI is in place and old messaging UI is removed.
|
||||
* TODO: This function should be removed once the new group messaging UI is in place and the old messaging UI is removed.
|
||||
* For now we are not removing/deprecating this function for backwards compatibility with messaging UI.
|
||||
* But we are deprecating data_for_messagearea_search_users external function.
|
||||
* Followup: MDL-63915
|
||||
@@ -788,6 +788,10 @@ class api {
|
||||
/**
|
||||
* Returns the contacts to display in the contacts area.
|
||||
*
|
||||
* TODO: This function should be removed once the new group messaging UI is in place and the old messaging UI is removed.
|
||||
* For now we are not removing/deprecating this function for backwards compatibility with messaging UI.
|
||||
* Followup: MDL-63915
|
||||
*
|
||||
* @param int $userid The user id
|
||||
* @param int $limitfrom
|
||||
* @param int $limitnum
|
||||
@@ -909,7 +913,10 @@ class api {
|
||||
/**
|
||||
* Returns the messages to display in the message area.
|
||||
*
|
||||
* @deprecated since 3.6
|
||||
* TODO: This function should be removed once the new group messaging UI is in place and the old messaging UI is removed.
|
||||
* For now we are not removing/deprecating this function for backwards compatibility with messaging UI.
|
||||
* Followup: MDL-63915
|
||||
*
|
||||
* @param int $userid the current user
|
||||
* @param int $otheruserid the other user
|
||||
* @param int $limitfrom
|
||||
@@ -921,8 +928,6 @@ class api {
|
||||
*/
|
||||
public static function get_messages($userid, $otheruserid, $limitfrom = 0, $limitnum = 0,
|
||||
$sort = 'timecreated ASC', $timefrom = 0, $timeto = 0) {
|
||||
debugging('\core_message\api::get_messages() is deprecated, please use ' .
|
||||
'\core_message\api::get_conversation_messages() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
if (!empty($timefrom)) {
|
||||
// Get the conversation between userid and otheruserid.
|
||||
@@ -993,15 +998,15 @@ class api {
|
||||
/**
|
||||
* Returns the most recent message between two users.
|
||||
*
|
||||
* @deprecated since 3.6
|
||||
* TODO: This function should be removed once the new group messaging UI is in place and the old messaging UI is removed.
|
||||
* For now we are not removing/deprecating this function for backwards compatibility with messaging UI.
|
||||
* Followup: MDL-63915
|
||||
*
|
||||
* @param int $userid the current user
|
||||
* @param int $otheruserid the other user
|
||||
* @return \stdClass|null
|
||||
*/
|
||||
public static function get_most_recent_message($userid, $otheruserid) {
|
||||
debugging('\core_message\api::get_most_recent_message() is deprecated, please use ' .
|
||||
'\core_message\api::get_most_recent_conversation_message() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
// We want two messages here so we get an accurate 'blocktime' value.
|
||||
if ($messages = helper::get_messages($userid, $otheruserid, 0, 0, 2, 'timecreated DESC')) {
|
||||
// Swap the order so we now have them in historical order.
|
||||
@@ -1038,6 +1043,10 @@ class api {
|
||||
/**
|
||||
* Returns the profile information for a contact for a user.
|
||||
*
|
||||
* TODO: This function should be removed once the new group messaging UI is in place and the old messaging UI is removed.
|
||||
* For now we are not removing/deprecating this function for backwards compatibility with messaging UI.
|
||||
* Followup: MDL-63915
|
||||
*
|
||||
* @param int $userid The user id
|
||||
* @param int $otheruserid The id of the user whose profile we want to view.
|
||||
* @return \stdClass
|
||||
|
||||
@@ -37,7 +37,10 @@ class helper {
|
||||
/**
|
||||
* Helper function to retrieve the messages between two users
|
||||
*
|
||||
* @deprecated since 3.6
|
||||
* TODO: This function should be removed once the new group messaging UI is in place and the old messaging UI is removed.
|
||||
* For now we are not removing/deprecating this function for backwards compatibility with messaging UI.
|
||||
* Followup: MDL-63915
|
||||
*
|
||||
* @param int $userid the current user
|
||||
* @param int $otheruserid the other user
|
||||
* @param int $timedeleted the time the message was deleted
|
||||
@@ -50,9 +53,6 @@ class helper {
|
||||
*/
|
||||
public static function get_messages($userid, $otheruserid, $timedeleted = 0, $limitfrom = 0, $limitnum = 0,
|
||||
$sort = 'timecreated ASC', $timefrom = 0, $timeto = 0) {
|
||||
debugging('\core_message\helper::get_messages() is deprecated, please use ' .
|
||||
'\core_message\helper::get_conversation_messages() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
global $DB;
|
||||
|
||||
$hash = self::get_conversation_hash([$userid, $otheruserid]);
|
||||
@@ -229,15 +229,15 @@ class helper {
|
||||
/**
|
||||
* Helper function to return an array of messages.
|
||||
*
|
||||
* @deprecated since 3.6
|
||||
* TODO: This function should be removed once the new group messaging UI is in place and the old messaging UI is removed.
|
||||
* For now we are not removing/deprecating this function for backwards compatibility with messaging UI.
|
||||
* Followup: MDL-63915
|
||||
*
|
||||
* @param int $userid
|
||||
* @param array $messages
|
||||
* @return array
|
||||
*/
|
||||
public static function create_messages($userid, $messages) {
|
||||
debugging('\core_message\helper::create_messages() is deprecated, please use ' .
|
||||
'\core_message\helper::create_conversation_messages() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
// Store the messages.
|
||||
$arrmessages = array();
|
||||
|
||||
|
||||
@@ -1818,7 +1818,6 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
|
||||
|
||||
// Retrieve the messages.
|
||||
$messages = \core_message\api::get_messages($user1->id, $user2->id);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// Confirm the message data is correct.
|
||||
$this->assertEquals(4, count($messages));
|
||||
@@ -2341,7 +2340,6 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
|
||||
|
||||
// Retrieve the most recent messages.
|
||||
$message = \core_message\api::get_most_recent_message($user1->id, $user2->id);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// Check the results are correct.
|
||||
$this->assertEquals($user2->id, $message->useridfrom);
|
||||
@@ -3109,7 +3107,6 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
|
||||
|
||||
// Retrieve the messages from $time, which should be all of them.
|
||||
$messages = \core_message\api::get_messages($user1->id, $user2->id, 0, 0, 'timecreated ASC', $time);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// Confirm the message data is correct.
|
||||
$this->assertEquals(4, count($messages));
|
||||
@@ -3126,7 +3123,6 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
|
||||
|
||||
// Retrieve the messages from $time + 3, which should only be the 2 last messages.
|
||||
$messages = \core_message\api::get_messages($user1->id, $user2->id, 0, 0, 'timecreated ASC', $time + 3);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// Confirm the message data is correct.
|
||||
$this->assertEquals(2, count($messages));
|
||||
@@ -3158,7 +3154,6 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
|
||||
|
||||
// Retrieve the messages up until $time + 4, which should be all of them.
|
||||
$messages = \core_message\api::get_messages($user1->id, $user2->id, 0, 0, 'timecreated ASC', 0, $time + 4);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// Confirm the message data is correct.
|
||||
$this->assertEquals(4, count($messages));
|
||||
@@ -3175,7 +3170,6 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
|
||||
|
||||
// Retrieve the messages up until $time + 2, which should be the first two.
|
||||
$messages = \core_message\api::get_messages($user1->id, $user2->id, 0, 0, 'timecreated ASC', 0, $time + 2);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// Confirm the message data is correct.
|
||||
$this->assertEquals(2, count($messages));
|
||||
@@ -3207,7 +3201,6 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
|
||||
|
||||
// Retrieve the messages from $time + 2 up until $time + 3, which should be 2nd and 3rd message.
|
||||
$messages = \core_message\api::get_messages($user1->id, $user2->id, 0, 0, 'timecreated ASC', $time + 2, $time + 3);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// Confirm the message data is correct.
|
||||
$this->assertEquals(2, count($messages));
|
||||
|
||||
@@ -3111,7 +3111,6 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Retrieve the messages.
|
||||
$result = core_message_external::data_for_messagearea_messages($user1->id, $user2->id);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// We need to execute the return values cleaning process to simulate the web service server.
|
||||
$result = external_api::clean_returnvalue(core_message_external::data_for_messagearea_messages_returns(),
|
||||
@@ -3176,7 +3175,6 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Retrieve the messages from $time - 3, which should be the 3 most recent messages.
|
||||
$result = core_message_external::data_for_messagearea_messages($user1->id, $user2->id, 0, 0, false, $time - 3);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// We need to execute the return values cleaning process to simulate the web service server.
|
||||
$result = external_api::clean_returnvalue(core_message_external::data_for_messagearea_messages_returns(),
|
||||
@@ -3217,7 +3215,6 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Retrieve the messages.
|
||||
$result = core_message_external::data_for_messagearea_messages($user1->id, $user2->id);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// We need to execute the return values cleaning process to simulate the web service server.
|
||||
$result = external_api::clean_returnvalue(core_message_external::data_for_messagearea_messages_returns(),
|
||||
@@ -3577,7 +3574,6 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Get the most recent message.
|
||||
$result = core_message_external::data_for_messagearea_get_most_recent_message($user1->id, $user2->id);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// We need to execute the return values cleaning process to simulate the web service server.
|
||||
$result = external_api::clean_returnvalue(core_message_external::data_for_messagearea_get_most_recent_message_returns(),
|
||||
@@ -3611,7 +3607,6 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Get the most recent message.
|
||||
$result = core_message_external::data_for_messagearea_get_most_recent_message($user1->id, $user2->id);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
|
||||
// We need to execute the return values cleaning process to simulate the web service server.
|
||||
$result = external_api::clean_returnvalue(core_message_external::data_for_messagearea_get_most_recent_message_returns(),
|
||||
|
||||
@@ -31,11 +31,6 @@ information provided here is intended especially for developers.
|
||||
- \core_message\api::delete_conversation()
|
||||
- \core_message\api::is_user_non_contact_blocked()
|
||||
- \core_message\api::create_conversation_between_users()
|
||||
- \core_message\api::get_messages()
|
||||
- \core_message\api::get_most_recent_message()
|
||||
- \core_message\helper::get_messages()
|
||||
- \core_message\helper::create_messages()
|
||||
- \core_message\api::search_users()
|
||||
* The method \core_message\api::can_delete_conversation() now expects a 'conversationid' to be passed
|
||||
as the second parameter.
|
||||
* The following web services have been deprecated. Please do not call these any more.
|
||||
|
||||
Reference in New Issue
Block a user