From 34b940f6825f4b3a0886bf821e4684ddd892369d Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Thu, 22 Nov 2018 14:43:27 +0800 Subject: [PATCH 1/2] MDL-64165 core_message: removed unused params from WS helper method --- message/externallib.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/message/externallib.php b/message/externallib.php index f842b85a2f2..c3354913be7 100644 --- a/message/externallib.php +++ b/message/externallib.php @@ -827,7 +827,7 @@ class core_message_external extends external_api { */ public static function get_conversation_members_returns() { return new external_multiple_structure( - self::get_conversation_member_structure(true) + self::get_conversation_member_structure() ); } @@ -1074,7 +1074,7 @@ class core_message_external extends external_api { 'unreadcount' => new external_value(PARAM_INT, 'The number of unread messages in this conversation', VALUE_DEFAULT, null), 'members' => new external_multiple_structure( - self::get_conversation_member_structure(true) + self::get_conversation_member_structure() ), 'messages' => new external_multiple_structure( self::get_conversation_message_structure() @@ -1086,13 +1086,10 @@ class core_message_external extends external_api { /** * Return the structure of a conversation member. * - * @param bool $includecontactrequests Are we including contact requests? - * @param bool $includeconversations Are we including conversations? * @return external_single_structure * @since Moodle 3.6 */ - private static function get_conversation_member_structure(bool $includecontactrequests = false, - bool $includeconversations = false) { + private static function get_conversation_member_structure() { $result = [ 'id' => new external_value(PARAM_INT, 'The user id'), 'fullname' => new external_value(PARAM_NOTAGS, 'The user\'s name'), @@ -1448,10 +1445,10 @@ class core_message_external extends external_api { return new external_single_structure( array( 'contacts' => new external_multiple_structure( - self::get_conversation_member_structure(false, true) + self::get_conversation_member_structure() ), 'noncontacts' => new external_multiple_structure( - self::get_conversation_member_structure(false, true) + self::get_conversation_member_structure() ) ) ); @@ -4275,7 +4272,7 @@ class core_message_external extends external_api { */ public static function get_member_info_returns() { return new external_multiple_structure( - self::get_conversation_member_structure(true) + self::get_conversation_member_structure() ); } } From 2be9a4aecb2314596bc5d95e9df164dd18df183c Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Thu, 22 Nov 2018 14:45:50 +0800 Subject: [PATCH 2/2] MDL-64165 core_message: fixed contact requests web service structure --- message/externallib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/message/externallib.php b/message/externallib.php index c3354913be7..9906de52962 100644 --- a/message/externallib.php +++ b/message/externallib.php @@ -1107,10 +1107,10 @@ class core_message_external extends external_api { $result['contactrequests'] = new external_multiple_structure( new external_single_structure( [ - 'id' => new external_value(PARAM_INT, 'The id of the message'), - 'userid' => new external_value(PARAM_INT, 'The id of the user who sent the message'), - 'requesteduserid' => new external_value(PARAM_RAW, 'The text of the message'), - 'timecreated' => new external_value(PARAM_INT, 'The timecreated timestamp for the message'), + 'id' => new external_value(PARAM_INT, 'The id of the contact request'), + 'userid' => new external_value(PARAM_INT, 'The id of the user who created the contact request'), + 'requesteduserid' => new external_value(PARAM_INT, 'The id of the user confirming the request'), + 'timecreated' => new external_value(PARAM_INT, 'The timecreated timestamp for the contact request'), ] ), 'The contact requests', VALUE_OPTIONAL );