Skip to content

Commit

Permalink
MDL-63261 messaging: Final 3.6 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocolate-lightning committed Sep 7, 2020
1 parent 99777d9 commit ee94ade
Show file tree
Hide file tree
Showing 24 changed files with 575 additions and 5,686 deletions.
126 changes: 0 additions & 126 deletions lib/db/services.php
Expand Up @@ -1104,26 +1104,6 @@
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_block_contacts' => array(
'classname' => 'core_message_external',
'methodname' => 'block_contacts',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Block contacts',
'type' => 'write',
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_create_contacts' => array(
'classname' => 'core_message_external',
'methodname' => 'create_contacts',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Add contacts to the contact list',
'type' => 'write',
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_get_contact_requests' => array(
'classname' => 'core_message_external',
'methodname' => 'get_contact_requests',
Expand Down Expand Up @@ -1178,17 +1158,6 @@
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_delete_conversation' => array(
'classname' => 'core_message_external',
'methodname' => 'delete_conversation',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Deletes a conversation.',
'type' => 'write',
'capabilities' => 'moodle/site:deleteownmessage',
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_delete_conversations_by_id' => array(
'classname' => 'core_message_external',
'methodname' => 'delete_conversations_by_id',
Expand Down Expand Up @@ -1226,24 +1195,6 @@
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_data_for_messagearea_search_users' => array(
'classname' => 'core_message_external',
'methodname' => 'data_for_messagearea_search_users',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Retrieve the template data for searching for people',
'type' => 'read',
'ajax' => true,
),
'core_message_data_for_messagearea_search_users_in_course' => array(
'classname' => 'core_message_external',
'methodname' => 'data_for_messagearea_search_users_in_course',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Retrieve the template data for searching for people in a course',
'type' => 'read',
'ajax' => true,
),
'core_message_message_search_users' => array(
'classname' => 'core_message_external',
'methodname' => 'message_search_users',
Expand All @@ -1253,63 +1204,6 @@
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_data_for_messagearea_conversations' => array(
'classname' => 'core_message_external',
'methodname' => 'data_for_messagearea_conversations',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Retrieve the template data for the conversation list',
'type' => 'read',
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_data_for_messagearea_contacts' => array(
'classname' => 'core_message_external',
'methodname' => 'data_for_messagearea_contacts',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Retrieve the template data for the contact list',
'type' => 'read',
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_data_for_messagearea_messages' => array(
'classname' => 'core_message_external',
'methodname' => 'data_for_messagearea_messages',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Retrieve the template data for the messages',
'type' => 'read',
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_data_for_messagearea_get_most_recent_message' => array(
'classname' => 'core_message_external',
'methodname' => 'data_for_messagearea_get_most_recent_message',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Retrieve the template data for the most recent message',
'type' => 'read',
'ajax' => true,
),
'core_message_data_for_messagearea_get_profile' => array(
'classname' => 'core_message_external',
'methodname' => 'data_for_messagearea_get_profile',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Retrieve the template data for the users\'s profile',
'type' => 'read',
'ajax' => true,
),
'core_message_get_contacts' => array(
'classname' => 'core_message_external',
'methodname' => 'get_contacts',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Retrieve the contact list',
'type' => 'read',
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_get_user_contacts' => array(
'classname' => 'core_message_external',
'methodname' => 'get_user_contacts',
Expand Down Expand Up @@ -1419,16 +1313,6 @@
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_mark_all_messages_as_read' => array(
'classname' => 'core_message_external',
'methodname' => 'mark_all_messages_as_read',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Mark all messages as read for a given user',
'type' => 'write',
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_mark_all_conversation_messages_as_read' => array(
'classname' => 'core_message_external',
'methodname' => 'mark_all_conversation_messages_as_read',
Expand Down Expand Up @@ -1519,16 +1403,6 @@
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_unblock_contacts' => array(
'classname' => 'core_message_external',
'methodname' => 'unblock_contacts',
'classpath' => 'message/externallib.php',
'description' => '** DEPRECATED ** Please do not call this function any more.
Unblock contacts',
'type' => 'write',
'ajax' => true,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
'core_message_get_user_notification_preferences' => array(
'classname' => 'core_message_external',
'methodname' => 'get_user_notification_preferences',
Expand Down
2 changes: 1 addition & 1 deletion message/amd/build/message_repository.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion message/amd/build/message_repository.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion message/amd/build/toggle_contact_button.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion message/amd/build/toggle_contact_button.min.js.map

Large diffs are not rendered by default.

83 changes: 0 additions & 83 deletions message/amd/src/message_repository.js
Expand Up @@ -36,48 +36,6 @@ define(

var CONVERSATION_TYPES = Constants.CONVERSATION_TYPES;

/**
* Retrieve a list of messages from the server.
*
* @param {object} args The request arguments:
* @return {object} jQuery promise
*/
var query = function(args) {
// Normalise the arguments to use limit/offset rather than limitnum/limitfrom.
if (typeof args.limit === 'undefined') {
args.limit = 0;
}

if (typeof args.offset === 'undefined') {
args.offset = 0;
}

if (typeof args.type === 'undefined') {
args.type = null;
}

if (typeof args.favouritesonly === 'undefined') {
args.favouritesonly = false;
}

args.limitfrom = args.offset;
args.limitnum = args.limit;

delete args.limit;
delete args.offset;

var request = {
methodname: 'core_message_data_for_messagearea_conversations',
args: args
};

var promise = Ajax.call([request])[0];

promise.fail(Notification.exception);

return promise;
};

/**
* Count the number of unread conversations (one or more messages from a user)
* for a given user.
Expand All @@ -98,25 +56,6 @@ define(
return promise;
};

/**
* Mark all of unread messages for a user as read.
*
* @param {object} args The request arguments:
* @return {object} jQuery promise
*/
var markAllAsRead = function(args) {
var request = {
methodname: 'core_message_mark_all_messages_as_read',
args: args
};

var promise = Ajax.call([request])[0];

promise.fail(Notification.exception);

return promise;
};

/**
* Get contacts for given user.
*
Expand Down Expand Up @@ -146,25 +85,6 @@ define(
return Ajax.call([request])[0];
};

/**
* Request profile information as a user for a given user.
*
* @param {int} userId The requesting user
* @param {int} profileUserId The id of the user who's profile is being requested
* @return {object} jQuery promise
*/
var getProfile = function(userId, profileUserId) {
var request = {
methodname: 'core_message_data_for_messagearea_get_profile',
args: {
currentuserid: userId,
otheruserid: profileUserId
}
};

return Ajax.call([request])[0];
};

/**
* Block a user.
*
Expand Down Expand Up @@ -1139,11 +1059,8 @@ define(
};

return {
query: query,
countUnreadConversations: countUnreadConversations,
markAllAsRead: markAllAsRead,
getContacts: getContacts,
getProfile: getProfile,
blockUser: blockUser,
unblockUser: unblockUser,
createContactRequest: createContactRequest,
Expand Down
16 changes: 14 additions & 2 deletions message/amd/src/toggle_contact_button.js
Expand Up @@ -67,6 +67,17 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/cust
return element.attr('data-userid');
};

/**
* Get the id for the logged in user.
*
* @method getUserId
* @param {object} element jQuery object for the button
* @return {int}
*/
var getCurrentUserId = function(element) {
return element.attr('data-currentuserid');
};

/**
* Check if this element is currently loading.
*
Expand Down Expand Up @@ -117,9 +128,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/cust
}

var request = {
methodname: 'core_message_create_contacts',
methodname: 'core_message_create_contact_request',
args: {
userids: [getUserId(element)],
userid: getCurrentUserId(element),
requesteduserid: getUserId(element),
}
};
sendRequest(element, request).done(function() {
Expand Down

0 comments on commit ee94ade

Please sign in to comment.