{"version":3,"file":"message_repository.min.js","sources":["../src/message_repository.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Retrieves messages from the server.\n *\n * @module     core_message/message_repository\n * @class      message_repository\n * @package    message\n * @copyright  2016 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(\n[\n    'jquery',\n    'core/ajax',\n    'core/notification',\n    'core_message/message_drawer_view_conversation_constants'\n], function(\n    $,\n    Ajax,\n    Notification,\n    Constants) {\n\n    var CONVERSATION_TYPES = Constants.CONVERSATION_TYPES;\n\n    /**\n     * Retrieve a list of messages from the server.\n     *\n     * @param {object} args The request arguments:\n     * @return {object} jQuery promise\n     */\n    var query = function(args) {\n        // Normalise the arguments to use limit/offset rather than limitnum/limitfrom.\n        if (typeof args.limit === 'undefined') {\n            args.limit = 0;\n        }\n\n        if (typeof args.offset === 'undefined') {\n            args.offset = 0;\n        }\n\n        if (typeof args.type === 'undefined') {\n            args.type = null;\n        }\n\n        if (typeof args.favouritesonly === 'undefined') {\n            args.favouritesonly = false;\n        }\n\n        args.limitfrom = args.offset;\n        args.limitnum = args.limit;\n\n        delete args.limit;\n        delete args.offset;\n\n        var request = {\n            methodname: 'core_message_data_for_messagearea_conversations',\n            args: args\n        };\n\n        var promise = Ajax.call([request])[0];\n\n        promise.fail(Notification.exception);\n\n        return promise;\n    };\n\n    /**\n     * Count the number of unread conversations (one or more messages from a user)\n     * for a given user.\n     *\n     * @param {object} args The request arguments:\n     * @return {object} jQuery promise\n     */\n    var countUnreadConversations = function(args) {\n        var request = {\n            methodname: 'core_message_get_unread_conversations_count',\n            args: args\n        };\n\n        var promise = Ajax.call([request])[0];\n\n        promise.fail(Notification.exception);\n\n        return promise;\n    };\n\n    /**\n     * Mark all of unread messages for a user as read.\n     *\n     * @param {object} args The request arguments:\n     * @return {object} jQuery promise\n     */\n    var markAllAsRead = function(args) {\n        var request = {\n            methodname: 'core_message_mark_all_messages_as_read',\n            args: args\n        };\n\n        var promise = Ajax.call([request])[0];\n\n        promise.fail(Notification.exception);\n\n        return promise;\n    };\n\n    /**\n     * Get contacts for given user.\n     *\n     * @param {int} userId The user id\n     * @param {int} limit Limit for results\n     * @param {int} offset Offset for results\n     * @return {object} jQuery promise\n     */\n    var getContacts = function(userId, limit, offset) {\n        var args = {\n            userid: userId\n        };\n\n        if (typeof limit !== 'undefined') {\n            args.limitnum = limit;\n        }\n\n        if (typeof offset !== 'undefined') {\n            args.limitfrom = offset;\n        }\n\n        var request = {\n            methodname: 'core_message_get_user_contacts',\n            args: args\n        };\n\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Request profile information as a user for a given user.\n     *\n     * @param {int} userId The requesting user\n     * @param {int} profileUserId The id of the user who's profile is being requested\n     * @return {object} jQuery promise\n     */\n    var getProfile = function(userId, profileUserId) {\n        var request = {\n            methodname: 'core_message_data_for_messagearea_get_profile',\n            args: {\n                currentuserid: userId,\n                otheruserid: profileUserId\n            }\n        };\n\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Block a user.\n     *\n     * @param {int} userId The requesting user\n     * @param {int} blockedUserId Id of user to block\n     * @return {object} jQuery promise\n     */\n    var blockUser = function(userId, blockedUserId) {\n        var requests = [\n            {\n                methodname: 'core_message_block_user',\n                args: {\n                    userid: userId,\n                    blockeduserid: blockedUserId\n                }\n            },\n            {\n                methodname: 'core_message_get_member_info',\n                args: {\n                    referenceuserid: userId,\n                    userids: [blockedUserId],\n                    includecontactrequests: true,\n                    includeprivacyinfo: true\n                }\n            }\n        ];\n\n        // Wrap both requests in a single promise so that we can catch an error\n        // from either request.\n        return $.when.apply(null, Ajax.call(requests)).then(function(reponse1, profiles) {\n            // Only return the profile.\n            return profiles.length ? profiles[0] : {};\n        });\n    };\n\n    /**\n     * Unblock a user.\n     *\n     * @param {int} userId The requesting user\n     * @param {int} unblockedUserId Id of user to unblock\n     * @return {object} jQuery promise\n     */\n    var unblockUser = function(userId, unblockedUserId) {\n        var requests = [\n            {\n                methodname: 'core_message_unblock_user',\n                args: {\n                    userid: userId,\n                    unblockeduserid: unblockedUserId\n                }\n            },\n            {\n                methodname: 'core_message_get_member_info',\n                args: {\n                    referenceuserid: userId,\n                    userids: [unblockedUserId],\n                    includecontactrequests: true,\n                    includeprivacyinfo: true\n                }\n            }\n        ];\n\n        // Wrap both requests in a single promise so that we can catch an error\n        // from either request.\n        return $.when.apply(null, Ajax.call(requests)).then(function(reponse1, profiles) {\n            // Only return the profile.\n            return profiles.length ? profiles[0] : {};\n        });\n    };\n\n    /**\n     * Create a request to add a user as a contact.\n     *\n     * @param {int} userId The requesting user\n     * @param {int[]} requestUserIds List of user ids to add\n     * @return {object} jQuery promise\n     */\n    var createContactRequest = function(userId, requestUserIds) {\n        var request = {\n            methodname: 'core_message_create_contact_request',\n            args: {\n                userid: userId,\n                requesteduserid: requestUserIds\n            }\n        };\n\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Remove a list of users as contacts.\n     *\n     * @param {int} userId The requesting user\n     * @param {int[]} contactUserIds List of user ids to add\n     * @return {object} jQuery promise\n     */\n    var deleteContacts = function(userId, contactUserIds) {\n        var requests = [\n            {\n                methodname: 'core_message_delete_contacts',\n                args: {\n                    userid: userId,\n                    userids: contactUserIds\n                }\n            },\n            {\n                methodname: 'core_message_get_member_info',\n                args: {\n                    referenceuserid: userId,\n                    userids: contactUserIds,\n                    includecontactrequests: true,\n                    includeprivacyinfo: true\n                }\n            }\n        ];\n\n        return $.when.apply(null, Ajax.call(requests)).then(function(response1, profiles) {\n            // Return all of the profiles as an array.\n            return profiles;\n        });\n    };\n\n    /**\n     * Get messages between two users.\n     *\n     * @param {int} currentUserId The requesting user\n     * @param {int} conversationId Other user in the conversation\n     * @param {int} limit Limit for results\n     * @param {int} offset Offset for results\n     * @param {bool} newestFirst Order results by newest first\n     * @param {int} timeFrom Only return messages after this timestamp\n     * @return {object} jQuery promise\n     */\n    var getMessages = function(currentUserId, conversationId, limit, offset, newestFirst, timeFrom) {\n        var args = {\n            currentuserid: currentUserId,\n            convid: conversationId,\n            newest: newestFirst ? true : false\n        };\n\n        if (typeof limit !== 'undefined') {\n            args.limitnum = limit;\n        }\n\n        if (typeof offset !== 'undefined') {\n            args.limitfrom = offset;\n        }\n\n        if (typeof timeFrom !== 'undefined') {\n            args.timefrom = timeFrom;\n        }\n\n        var request = {\n            methodname: 'core_message_get_conversation_messages',\n            args: args\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Search for users.\n     *\n     * @param {int} userId The requesting user\n     * @param {string} searchString Search string\n     * @param {int} limit Limit for results\n     * @param {int} offset Offset for results\n     * @return {object} jQuery promise\n     */\n    var searchUsers = function(userId, searchString, limit, offset) {\n        var args = {\n            userid: userId,\n            search: searchString\n        };\n\n        if (typeof limit !== 'undefined') {\n            args.limitnum = limit;\n        }\n\n        if (typeof offset !== 'undefined') {\n            args.limitfrom = offset;\n        }\n\n        var request = {\n            methodname: 'core_message_message_search_users',\n            args: args\n        };\n\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Search for messages.\n     *\n     * @param {int} userId The requesting user\n     * @param {string} searchString Search string\n     * @param {int} limit Limit for results\n     * @param {int} offset Offset for results\n     * @return {object} jQuery promise\n     */\n    var searchMessages = function(userId, searchString, limit, offset) {\n        var args = {\n            userid: userId,\n            search: searchString\n        };\n\n        if (typeof limit !== 'undefined') {\n            args.limitnum = limit;\n        }\n\n        if (typeof offset !== 'undefined') {\n            args.limitfrom = offset;\n        }\n\n        var request = {\n            methodname: 'core_message_data_for_messagearea_search_messages',\n            args: args\n        };\n\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Send a list of messages to a user.\n     *\n     * @param {int} toUserId The recipient user id\n     * @param {string[]} messages List of messages to send\n     * @return {object} jQuery promise\n     */\n    var sendMessagesToUser = function(toUserId, messages) {\n        var formattedMessages = messages.map(function(message) {\n            return {\n                touserid: toUserId,\n                text: message\n            };\n        });\n        var request = {\n            methodname: 'core_message_send_instant_messages',\n            args: {\n                messages: formattedMessages\n            }\n        };\n\n        return Ajax.call([request])[0]\n            .then(function(results) {\n                // Error handling for the weird way the old function works.\n                var errors = results.reduce(function(carry, result) {\n                    if (result.errormessage) {\n                        carry.push(result.errormessage);\n                    }\n\n                    return carry;\n                }, []);\n                if (errors.length) {\n                    throw new Error(errors.join(\"\\n\"));\n                }\n\n                return results;\n            })\n            .then(function(results) {\n                // Format the results to match the other send message function.\n                return results.map(function(result) {\n                    return {\n                        id: result.msgid,\n                        text: result.text,\n                        timecreated: result.timecreated,\n                        useridfrom: result.useridfrom,\n                        conversationid: result.conversationid,\n                        candeletemessagesforallusers: result.candeletemessagesforallusers\n                    };\n                });\n            });\n    };\n\n    /**\n     * Send a single message to a user.\n     *\n     * @param {int} toUserId The recipient user id\n     * @param {string} text The message text\n     * @return {object} jQuery promise\n     */\n    var sendMessageToUser = function(toUserId, text) {\n        return sendMessagesToUser(toUserId, [text])\n            .then(function(results) {\n                return results[0];\n            });\n    };\n\n    /**\n     * Send messages to a conversation.\n     *\n     * @param {int} conversationId The conversation id\n     * @param {string[]} messages List of messages to send\n     * @return {object} jQuery promise\n     */\n    var sendMessagesToConversation = function(conversationId, messages) {\n        var formattedMessages = messages.map(function(message) {\n            return {\n                text: message\n            };\n        });\n        var request = {\n            methodname: 'core_message_send_messages_to_conversation',\n            args: {\n                conversationid: conversationId,\n                messages: formattedMessages\n            }\n        };\n\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Send a message to a conversation.\n     *\n     * @param {int} conversationId The conversation id\n     * @param {string} text The message text\n     * @return {object} jQuery promise\n     */\n    var sendMessageToConversation = function(conversationId, text) {\n        return sendMessagesToConversation(conversationId, [text])\n            .then(function(result) {\n                return result[0];\n            });\n    };\n\n    /**\n     * Save message preferences.\n     *\n     * @param {int} userId The owner of the preferences\n     * @param {object[]} preferences New preferences values\n     * @return {object} jQuery promise\n     */\n    var savePreferences = function(userId, preferences) {\n        var request = {\n            methodname: 'core_user_update_user_preferences',\n            args: {\n                userid: userId,\n                preferences: preferences\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Get the user's preferences.\n     *\n     * @param {int} userId The target user\n     * @return {object} jQuery promise\n     */\n    var getPreferences = function(userId) {\n        var request = {\n            methodname: 'core_user_get_user_preferences',\n            args: {\n                userid: userId\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Delete a list of messages.\n     *\n     * @param {int} userId The user to delete messages for\n     * @param {int[]} messageIds List of message ids to delete\n     * @return {object} jQuery promise\n     */\n    var deleteMessages = function(userId, messageIds) {\n        return $.when.apply(null, Ajax.call(messageIds.map(function(messageId) {\n            return {\n                methodname: 'core_message_delete_message',\n                args: {\n                    messageid: messageId,\n                    userid: userId\n                }\n            };\n        })));\n    };\n\n    /**\n     * Delete a list of messages for all users.\n     *\n     * @param {int} userId The user to delete messages for\n     * @param {int[]} messageIds List of message ids to delete\n     * @return {object} jQuery promise\n     */\n    var deleteMessagesForAllUsers = function(userId, messageIds) {\n        return $.when.apply(null, Ajax.call(messageIds.map(function(messageId) {\n            return {\n                methodname: 'core_message_delete_message_for_all_users',\n                args: {\n                    messageid: messageId,\n                    userid: userId\n                }\n            };\n        })));\n    };\n\n    /**\n     * Delete a conversation between two users.\n     *\n     * @param {int} userId The user to delete messages for\n     * @param {int} conversationId The id of the conversation\n     * @return {object} jQuery promise\n     */\n    var deleteConversation = function(userId, conversationId) {\n        var request = {\n            methodname: 'core_message_delete_conversations_by_id',\n            args: {\n                userid: userId,\n                conversationids: [conversationId]\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Get the list of contact requests for a user.\n     *\n     * @param {int} userId The user id\n     * @return {object} jQuery promise\n     */\n    var getContactRequests = function(userId) {\n        var request = {\n            methodname: 'core_message_get_contact_requests',\n            args: {\n                userid: userId\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Accept a contact request.\n     *\n     * @param {int} sendingUserId The user that sent the request\n     * @param {int} recipientUserId The user that received the request\n     * @return {object} jQuery promise\n     */\n    var acceptContactRequest = function(sendingUserId, recipientUserId) {\n        var requests = [\n            {\n                methodname: 'core_message_confirm_contact_request',\n                args: {\n                    userid: sendingUserId,\n                    requesteduserid: recipientUserId\n                }\n            },\n            {\n                methodname: 'core_message_get_member_info',\n                args: {\n                    referenceuserid: recipientUserId,\n                    userids: [sendingUserId],\n                    includecontactrequests: true,\n                    includeprivacyinfo: true\n                }\n            }\n        ];\n\n        // Wrap both requests in a single promise so that we can catch an error\n        // from either request.\n        return $.when.apply(null, Ajax.call(requests)).then(function(reponse1, profiles) {\n            // Only return the profile.\n            return profiles.length ? profiles[0] : {};\n        });\n    };\n\n    /**\n     * Decline a contact request.\n     *\n     * @param {int} sendingUserId The user that sent the request\n     * @param {int} recipientUserId The user that received the request\n     * @return {object} jQuery promise\n     */\n    var declineContactRequest = function(sendingUserId, recipientUserId) {\n        var requests = [\n            {\n                methodname: 'core_message_decline_contact_request',\n                args: {\n                    userid: sendingUserId,\n                    requesteduserid: recipientUserId\n                }\n            },\n            {\n                methodname: 'core_message_get_member_info',\n                args: {\n                    referenceuserid: recipientUserId,\n                    userids: [sendingUserId],\n                    includecontactrequests: true,\n                    includeprivacyinfo: true\n                }\n            }\n        ];\n\n        // Wrap both requests in a single promise so that we can catch an error\n        // from either request.\n        return $.when.apply(null, Ajax.call(requests)).then(function(reponse1, profiles) {\n            // Only return the profile.\n            return profiles.length ? profiles[0] : {};\n        });\n    };\n\n    /**\n     * Get a conversation.\n     *\n     * @param {int} loggedInUserId The logged in user\n     * @param {int} conversationId The conversation id\n     * @param {bool} includeContactRequests Incldue contact requests between members\n     * @param {bool} includePrivacyInfo Include privacy info for members\n     * @param {int} memberLimit Limit for members\n     * @param {int} memberOffset Offset for members\n     * @param {int} messageLimit Limit for messages\n     * @param {int} messageOffset Offset for messages\n     * @param {bool} newestMessagesFirst Order the messages by newest first\n     * @return {object} jQuery promise\n     */\n    var getConversation = function(\n        loggedInUserId,\n        conversationId,\n        includeContactRequests,\n        includePrivacyInfo,\n        memberLimit,\n        memberOffset,\n        messageLimit,\n        messageOffset,\n        newestMessagesFirst\n    ) {\n        var args = {\n            userid: loggedInUserId,\n            conversationid: conversationId\n        };\n\n        if (typeof includeContactRequests != 'undefined' && includeContactRequests !== null) {\n            args.includecontactrequests = includeContactRequests;\n        }\n\n        if (typeof includePrivacyInfo != 'undefined' && includePrivacyInfo !== null) {\n            args.includeprivacyinfo = includePrivacyInfo;\n        }\n\n        if (typeof memberLimit != 'undefined' && memberLimit !== null) {\n            args.memberlimit = memberLimit;\n        }\n\n        if (typeof memberOffset != 'undefined' && memberOffset !== null) {\n            args.memberoffset = memberOffset;\n        }\n\n        if (typeof messageLimit != 'undefined' && messageLimit !== null) {\n            args.messagelimit = messageLimit;\n        }\n\n        if (typeof messageOffset != 'undefined' && messageOffset !== null) {\n            args.messageoffset = messageOffset;\n        }\n\n        if (typeof newestMessagesFirst != 'undefined' && newestMessagesFirst !== null) {\n            args.newestmessagesfirst = newestMessagesFirst;\n        }\n\n        var request = {\n            methodname: 'core_message_get_conversation',\n            args: args\n        };\n\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Get a conversation between users.\n     *\n     * @param {int} loggedInUserId The logged in user\n     * @param {int} otherUserId The other user id\n     * @param {bool} includeContactRequests Incldue contact requests between members\n     * @param {bool} includePrivacyInfo Include privacy info for members\n     * @param {int} memberLimit Limit for members\n     * @param {int} memberOffset Offset for members\n     * @param {int} messageLimit Limit for messages\n     * @param {int} messageOffset Offset for messages\n     * @param {bool} newestMessagesFirst Order the messages by newest first\n     * @return {object} jQuery promise\n     */\n    var getConversationBetweenUsers = function(\n        loggedInUserId,\n        otherUserId,\n        includeContactRequests,\n        includePrivacyInfo,\n        memberLimit,\n        memberOffset,\n        messageLimit,\n        messageOffset,\n        newestMessagesFirst\n    ) {\n        var args = {\n            userid: loggedInUserId,\n            otheruserid: otherUserId\n        };\n\n        if (typeof includeContactRequests != 'undefined' && includeContactRequests !== null) {\n            args.includecontactrequests = includeContactRequests;\n        }\n\n        if (typeof includePrivacyInfo != 'undefined' && includePrivacyInfo !== null) {\n            args.includeprivacyinfo = includePrivacyInfo;\n        }\n\n        if (typeof memberLimit != 'undefined' && memberLimit !== null) {\n            args.memberlimit = memberLimit;\n        }\n\n        if (typeof memberOffset != 'undefined' && memberOffset !== null) {\n            args.memberoffset = memberOffset;\n        }\n\n        if (typeof messageLimit != 'undefined' && messageLimit !== null) {\n            args.messagelimit = messageLimit;\n        }\n\n        if (typeof messageOffset != 'undefined' && messageOffset !== null) {\n            args.messageoffset = messageOffset;\n        }\n\n        if (typeof newestMessagesFirst != 'undefined' && newestMessagesFirst !== null) {\n            args.newestmessagesfirst = newestMessagesFirst;\n        }\n\n        var request = {\n            methodname: 'core_message_get_conversation_between_users',\n            args: args\n        };\n\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Get a self-conversation.\n     *\n     * @param {int} loggedInUserId The logged in user\n     * @param {int} messageLimit Limit for messages\n     * @param {int} messageOffset Offset for messages\n     * @param {bool} newestMessagesFirst Order the messages by newest first\n     * @return {object} jQuery promise\n     */\n    var getSelfConversation = function(\n        loggedInUserId,\n        messageLimit,\n        messageOffset,\n        newestMessagesFirst\n    ) {\n        var args = {\n            userid: loggedInUserId\n        };\n\n        if (typeof messageLimit != 'undefined' && messageLimit !== null) {\n            args.messagelimit = messageLimit;\n        }\n\n        if (typeof messageOffset != 'undefined' && messageOffset !== null) {\n            args.messageoffset = messageOffset;\n        }\n\n        if (typeof newestMessagesFirst != 'undefined' && newestMessagesFirst !== null) {\n            args.newestmessagesfirst = newestMessagesFirst;\n        }\n\n        var request = {\n            methodname: 'core_message_get_self_conversation',\n            args: args\n        };\n\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Get the conversations for a user.\n     *\n     * @param {int} userId The logged in user\n     * @param {int|null} type The type of conversation to get\n     * @param {int} limit Limit for results\n     * @param {int} offset Offset for results\n     * @param {bool|null} favourites If favourites should be included or not\n     * @return {object} jQuery promise\n     */\n    var getConversations = function(\n        userId,\n        type,\n        limit,\n        offset,\n        favourites,\n        mergeself\n    ) {\n        var args = {\n            userid: userId,\n            type: type\n        };\n\n        if (typeof limit != 'undefined' && limit !== null) {\n            args.limitnum = limit;\n        }\n\n        if (typeof offset != 'undefined' && offset !== null) {\n            args.limitfrom = offset;\n        }\n\n        if (typeof favourites != 'undefined' && favourites !== null) {\n            args.favourites = favourites;\n        }\n\n        if (typeof mergeself != 'undefined' && mergeself !== null) {\n            args.mergeself = mergeself;\n        }\n\n        var request = {\n            methodname: 'core_message_get_conversations',\n            args: args\n        };\n\n        return Ajax.call([request])[0]\n            .then(function(result) {\n                if (result.conversations.length) {\n                    result.conversations = result.conversations.map(function(conversation) {\n                        if (conversation.type == CONVERSATION_TYPES.PRIVATE || conversation.type == CONVERSATION_TYPES.SELF) {\n                            var otherUser = conversation.members.length ? conversation.members[0] : null;\n\n                            if (otherUser) {\n                                conversation.name = conversation.name ? conversation.name : otherUser.fullname;\n                                conversation.imageurl = conversation.imageurl ? conversation.imageurl : otherUser.profileimageurl;\n                            }\n                        }\n\n                        return conversation;\n                    });\n                }\n\n                return result;\n            });\n    };\n\n    /**\n     * Get the conversations for a user.\n     *\n     * @param {int} conversationId The conversation id\n     * @param {int} loggedInUserId The logged in user\n     * @param {int} limit Limit for results\n     * @param {int} offset Offset for results\n     * @param {bool} includeContactRequests If contact requests should be included in result\n     * @return {object} jQuery promise\n     */\n    var getConversationMembers = function(conversationId, loggedInUserId, limit, offset, includeContactRequests) {\n        var args = {\n            userid: loggedInUserId,\n            conversationid: conversationId\n        };\n\n        if (typeof limit != 'undefined' && limit !== null) {\n            args.limitnum = limit;\n        }\n\n        if (typeof offset != 'undefined' && offset !== null) {\n            args.limitfrom = offset;\n        }\n\n        if (typeof includeContactRequests != 'undefined' && includeContactRequests !== null) {\n            args.includecontactrequests = includeContactRequests;\n        }\n\n        var request = {\n            methodname: 'core_message_get_conversation_members',\n            args: args\n        };\n\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Set a list of conversations to set as favourites for the given user.\n     *\n     * @param {int} userId The user id\n     * @param {array} conversationIds List of conversation ids to set as favourite\n     * @return {object} jQuery promise\n     */\n    var setFavouriteConversations = function(userId, conversationIds) {\n\n        var request = {\n            methodname: 'core_message_set_favourite_conversations',\n            args: {\n                userid: userId,\n                conversations: conversationIds\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Set a list of conversations to unset as favourites for the given user.\n     *\n     * @param {int} userId The user id\n     * @param {array} conversationIds List of conversation ids to unset as favourite\n     * @return {object} jQuery promise\n     */\n    var unsetFavouriteConversations = function(userId, conversationIds) {\n\n        var request = {\n            methodname: 'core_message_unset_favourite_conversations',\n            args: {\n                userid: userId,\n                conversations: conversationIds\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Set a list of conversations to set as muted for the given user.\n     *\n     * @param {int} userId The user id\n     * @param {array} conversationIds List of conversation ids to set as favourite\n     * @return {object} jQuery promise\n     */\n    var setMutedConversations = function(userId, conversationIds) {\n        var request = {\n            methodname: 'core_message_mute_conversations',\n            args: {\n                userid: userId,\n                conversationids: conversationIds\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Set a list of conversations to unset as muted for the given user.\n     *\n     * @param {int} userId The user id\n     * @param {array} conversationIds List of conversation ids to unset as favourite\n     * @return {object} jQuery promise\n     */\n    var unsetMutedConversations = function(userId, conversationIds) {\n        var request = {\n            methodname: 'core_message_unmute_conversations',\n            args: {\n                userid: userId,\n                conversationids: conversationIds\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Get a list of user's member info.\n     *\n     * @param {int} referenceUserId The user id\n     * @param {array} userIds List of user ids to get\n     * @param {bool} includeContactRequests Include contact requests between users in response\n     * @param {bool} includePrivacyInfo Include privacy info for reference user in response\n     * @return {object} jQuery promise\n     */\n    var getMemberInfo = function(referenceUserId, userIds, includeContactRequests, includePrivacyInfo) {\n        var args = {\n            referenceuserid: referenceUserId,\n            userids: userIds\n        };\n\n        if (typeof includeContactRequests != 'undefined') {\n            args.includecontactrequests = includeContactRequests;\n        }\n\n        if (typeof includePrivacyInfo != 'undefined') {\n            args.includeprivacyinfo = includePrivacyInfo;\n        }\n\n        var request = {\n            methodname: 'core_message_get_member_info',\n            args: args\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Get a list of user's member info.\n     *\n     * @param {int} userId The user id to mark as read for\n     * @param {int} conversationId The conversation to mark as read\n     * @return {object} jQuery promise\n     */\n    var markAllConversationMessagesAsRead = function(userId, conversationId) {\n\n        var request = {\n            methodname: 'core_message_mark_all_conversation_messages_as_read',\n            args: {\n                userid: userId,\n                conversationid: conversationId\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Get the user's message preferences.\n     *\n     * @param {int} userId The user id to load preferences for\n     * @return {object} jQuery promise\n     */\n    var getUserMessagePreferences = function(userId) {\n        var request = {\n            methodname: 'core_message_get_user_message_preferences',\n            args: {\n                userid: userId\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * The the count of the user's conversations grouped by type.\n     *\n     * @param {Number} userId The user's id.\n     * @return {Object} jQuery promise.\n     */\n    var getTotalConversationCounts = function(userId) {\n        var request = {\n            methodname: 'core_message_get_conversation_counts',\n            args: {\n                userid: userId\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * The the count of the user's unread conversations grouped by type.\n     *\n     * @param {Number} userId The user's id.\n     * @return {Object} jQuery promise.\n     */\n    var getUnreadConversationCounts = function(userId) {\n        var request = {\n            methodname: 'core_message_get_unread_conversation_counts',\n            args: {\n                userid: userId\n            }\n        };\n        return Ajax.call([request])[0];\n    };\n\n    /**\n     * Get both the unread and total conversation counts in a single request.\n     *\n     * @param {Number} userId The user's id.\n     * @return {Object} jQuery promise.\n     */\n    var getAllConversationCounts = function(userId) {\n        var requests = [\n            {\n                methodname: 'core_message_get_conversation_counts',\n                args: {\n                    userid: userId\n                }\n            },\n            {\n                methodname: 'core_message_get_unread_conversation_counts',\n                args: {\n                    userid: userId\n                }\n            },\n        ];\n        return $.when.apply(null, Ajax.call(requests)).then(function(total, unread) {\n            return {\n                total: total,\n                unread: unread\n            };\n        });\n    };\n\n    return {\n        query: query,\n        countUnreadConversations: countUnreadConversations,\n        markAllAsRead: markAllAsRead,\n        getContacts: getContacts,\n        getProfile: getProfile,\n        blockUser: blockUser,\n        unblockUser: unblockUser,\n        createContactRequest: createContactRequest,\n        deleteContacts: deleteContacts,\n        getMessages: getMessages,\n        searchUsers: searchUsers,\n        searchMessages: searchMessages,\n        sendMessagesToUser: sendMessagesToUser,\n        sendMessageToUser: sendMessageToUser,\n        sendMessagesToConversation: sendMessagesToConversation,\n        sendMessageToConversation: sendMessageToConversation,\n        savePreferences: savePreferences,\n        getPreferences: getPreferences,\n        deleteMessages: deleteMessages,\n        deleteMessagesForAllUsers: deleteMessagesForAllUsers,\n        deleteConversation: deleteConversation,\n        getContactRequests: getContactRequests,\n        acceptContactRequest: acceptContactRequest,\n        declineContactRequest: declineContactRequest,\n        getConversation: getConversation,\n        getConversationBetweenUsers: getConversationBetweenUsers,\n        getSelfConversation: getSelfConversation,\n        getConversations: getConversations,\n        getConversationMembers: getConversationMembers,\n        setFavouriteConversations: setFavouriteConversations,\n        setMutedConversations: setMutedConversations,\n        unsetFavouriteConversations: unsetFavouriteConversations,\n        unsetMutedConversations: unsetMutedConversations,\n        getMemberInfo: getMemberInfo,\n        markAllConversationMessagesAsRead: markAllConversationMessagesAsRead,\n        getUserMessagePreferences: getUserMessagePreferences,\n        getTotalConversationCounts: getTotalConversationCounts,\n        getUnreadConversationCounts: getUnreadConversationCounts,\n        getAllConversationCounts: getAllConversationCounts\n    };\n});\n"],"names":["define","$","Ajax","Notification","Constants","CONVERSATION_TYPES","sendMessagesToUser","toUserId","messages","request","methodname","args","map","message","touserid","text","call","then","results","errors","reduce","carry","result","errormessage","push","length","Error","join","id","msgid","timecreated","useridfrom","conversationid","candeletemessagesforallusers","sendMessagesToConversation","conversationId","query","limit","offset","type","favouritesonly","limitfrom","limitnum","promise","fail","exception","countUnreadConversations","markAllAsRead","getContacts","userId","userid","getProfile","profileUserId","currentuserid","otheruserid","blockUser","blockedUserId","requests","blockeduserid","referenceuserid","userids","includecontactrequests","includeprivacyinfo","when","apply","reponse1","profiles","unblockUser","unblockedUserId","unblockeduserid","createContactRequest","requestUserIds","requesteduserid","deleteContacts","contactUserIds","response1","getMessages","currentUserId","newestFirst","timeFrom","convid","newest","timefrom","searchUsers","searchString","search","searchMessages","sendMessageToUser","sendMessageToConversation","savePreferences","preferences","getPreferences","deleteMessages","messageIds","messageId","messageid","deleteMessagesForAllUsers","deleteConversation","conversationids","getContactRequests","acceptContactRequest","sendingUserId","recipientUserId","declineContactRequest","getConversation","loggedInUserId","includeContactRequests","includePrivacyInfo","memberLimit","memberOffset","messageLimit","messageOffset","newestMessagesFirst","memberlimit","memberoffset","messagelimit","messageoffset","newestmessagesfirst","getConversationBetweenUsers","otherUserId","getSelfConversation","getConversations","favourites","mergeself","conversations","conversation","PRIVATE","SELF","otherUser","members","name","fullname","imageurl","profileimageurl","getConversationMembers","setFavouriteConversations","conversationIds","setMutedConversations","unsetFavouriteConversations","unsetMutedConversations","getMemberInfo","referenceUserId","userIds","markAllConversationMessagesAsRead","getUserMessagePreferences","getTotalConversationCounts","getUnreadConversationCounts","getAllConversationCounts","total","unread"],"mappings":";;;;;;;;;AAw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