Proyectos de Subversion Moodle

Rev

Rev 1 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

{"version":3,"file":"message_drawer_view_overview_section.min.js","sources":["../src/message_drawer_view_overview_section.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 * Controls a section of the overview page in the message drawer.\n *\n * @module     core_message/message_drawer_view_overview_section\n * @copyright  2018 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/custom_interaction_events',\n    'core/notification',\n    'core/pubsub',\n    'core/str',\n    'core/pending',\n    'core/templates',\n    'core/user_date',\n    'core_message/message_repository',\n    'core_message/message_drawer_events',\n    'core_message/message_drawer_router',\n    'core_message/message_drawer_routes',\n    'core_message/message_drawer_lazy_load_list',\n    'core_message/message_drawer_view_conversation_constants'\n],\nfunction(\n    $,\n    CustomEvents,\n    Notification,\n    PubSub,\n    Str,\n    Pending,\n    Templates,\n    UserDate,\n    MessageRepository,\n    MessageDrawerEvents,\n    MessageDrawerRouter,\n    MessageDrawerRoutes,\n    LazyLoadList,\n    MessageDrawerViewConversationContants\n) {\n\n    var SELECTORS = {\n        TOGGLE: '[data-region=\"toggle\"]',\n        CONVERSATION: '[data-conversation-id]',\n        BLOCKED_ICON_CONTAINER: '[data-region=\"contact-icon-blocked\"]',\n        LAST_MESSAGE: '[data-region=\"last-message\"]',\n        LAST_MESSAGE_DATE: '[data-region=\"last-message-date\"]',\n        MUTED_ICON_CONTAINER: '[data-region=\"muted-icon-container\"]',\n        UNREAD_COUNT: '[data-region=\"unread-count\"]',\n        SECTION_TOTAL_COUNT: '[data-region=\"section-total-count\"]',\n        SECTION_TOTAL_COUNT_CONTAINER: '[data-region=\"section-total-count-container\"]',\n        SECTION_UNREAD_COUNT: '[data-region=\"section-unread-count\"]',\n        SECTION_UNREAD_COUNT_CONTAINER: '[data-region=\"section-unread-count-container\"]',\n        PLACEHOLDER_CONTAINER: '[data-region=\"placeholder-container\"]'\n    };\n\n    var TEMPLATES = {\n        CONVERSATIONS_LIST: 'core_message/message_drawer_conversations_list',\n        CONVERSATIONS_LIST_ITEMS_PLACEHOLDER: 'core_message/message_drawer_conversations_list_items_placeholder'\n    };\n\n    var LOAD_LIMIT = 50;\n    var loadedConversationsById = {};\n    var deletedConversationsById = {};\n    var loadedTotalCounts = false;\n    var loadedUnreadCounts = false;\n\n    /**\n     * Get the section visibility status.\n     *\n     * @param  {Object} root The section container element.\n     * @return {Bool} Is section visible.\n     */\n    var isVisible = function(root) {\n        return LazyLoadList.getRoot(root).hasClass('show');\n    };\n\n    /**\n     * Set this section as expanded.\n     *\n     * @param  {Object} root The section container element.\n     */\n    var setExpanded = function(root) {\n        root.addClass('expanded');\n    };\n\n    /**\n     * Set this section as collapsed.\n     *\n     * @param  {Object} root The section container element.\n     */\n    var setCollapsed = function(root) {\n        root.removeClass('expanded');\n    };\n\n    /**\n     * Render the total count value and show it for the user. Also update the placeholder\n     * HTML for better visuals.\n     *\n     * @param {Object} root The section container element.\n     * @param {Number} count The total count\n     */\n    var renderTotalCount = function(root, count) {\n        var container = root.find(SELECTORS.SECTION_TOTAL_COUNT_CONTAINER);\n        var countElement = container.find(SELECTORS.SECTION_TOTAL_COUNT);\n        countElement.text(count);\n        container.removeClass('hidden');\n        Str.get_string('totalconversations', 'core_message', count).done(function(string) {\n            $('#' + container.attr('aria-labelledby')).text(string);\n        });\n\n        var numPlaceholders = count > 20 ? 20 : count;\n        // Array of \"true\" up to the number of placeholders we want.\n        var placeholders = Array.apply(null, Array(numPlaceholders)).map(function() {\n            return true;\n        });\n\n        // Replace the current placeholder (loading spinner) with some nicer placeholders that\n        // better represent the content.\n        Templates.render(TEMPLATES.CONVERSATIONS_LIST_ITEMS_PLACEHOLDER, {placeholders: placeholders})\n            .then(function(html) {\n                var placeholderContainer = root.find(SELECTORS.PLACEHOLDER_CONTAINER);\n                placeholderContainer.html(html);\n                return;\n            })\n            .catch(function() {\n                // Silently ignore. Doesn't matter if we can't render the placeholders.\n            });\n    };\n\n    /**\n     * Render the unread count value and show it for the user if it's higher than zero.\n     *\n     * @param {Object} root The section container element.\n     * @param {Number} count The unread count\n     */\n    var renderUnreadCount = function(root, count) {\n        var container = root.find(SELECTORS.SECTION_UNREAD_COUNT_CONTAINER);\n        var countElement = container.find(SELECTORS.SECTION_UNREAD_COUNT);\n        countElement.text(count);\n\n        Str.get_string('unreadconversations', 'core_message', count).done(function(string) {\n            $('#' + container.attr('aria-labelledby')).text(string);\n        });\n\n        if (count > 0) {\n            container.removeClass('hidden');\n        } else {\n            container.addClass('hidden');\n        }\n    };\n\n    /**\n     * Create a formatted conversation object from the the one we get from events. The new object\n     * will be in a format that matches what we receive from the server.\n     *\n     * @param {Object} conversation\n     * @return {Object} formatted conversation.\n     */\n    var formatConversationFromEvent = function(conversation) {\n        // Recursively lowercase all of the keys for an object.\n        var recursivelyLowercaseKeys = function(object) {\n            return Object.keys(object).reduce(function(carry, key) {\n                if ($.isArray(object[key])) {\n                    carry[key.toLowerCase()] = object[key].map(recursivelyLowercaseKeys);\n                } else {\n                    carry[key.toLowerCase()] = object[key];\n                }\n\n                return carry;\n            }, {});\n        };\n\n        // Recursively lowercase all of the keys for the conversation.\n        var formatted = recursivelyLowercaseKeys(conversation);\n\n        // Make sure all messages have the useridfrom property set.\n        formatted.messages = formatted.messages.map(function(message) {\n            message.useridfrom = message.userfrom.id;\n            return message;\n        });\n\n        return formatted;\n    };\n\n    /**\n     * Render the messages in the overview page.\n     *\n     * @param {Array} conversations List of conversations to render.\n     * @param {Number} userId Logged in user id.\n     * @return {Object} jQuery promise.\n     */\n    var render = function(conversations, userId) {\n\n        // Helper to format the last message for rendering.\n        // Returns a promise which resolves to either a string, or null\n        // (such as in the event of an empty personal space).\n        var pending = new Pending();\n\n        var formatMessagePreview = async function(lastMessage) {\n            if (!lastMessage) {\n                return null;\n            }\n            // Check the message html for a src attribute, indicative of media.\n            // Replace <img with <noimg to stop browsers pre-fetching the image as part of tmp element creation.\n            var tmpElement = document.createElement(\"element\");\n            tmpElement.innerHTML = lastMessage.text.replace(/<img /g, '<noimg ');\n            var isMedia = tmpElement.querySelector(\"[src]\") || false;\n\n            if (!isMedia) {\n                // Try to get the text value of the content.\n                // If that's not possible, we'll report it under the catch-all 'other media'.\n                var messagePreview = $(lastMessage.text).text();\n                if (messagePreview) {\n                    // The text value of the message must have no html/script tags.\n                    if (messagePreview.indexOf('<') == -1) {\n                        return messagePreview;\n                    }\n                }\n            }\n\n            // As a fallback, report unknowns as 'other media' type content.\n            var pix = 'i/messagecontentmultimediageneral';\n            var label = 'messagecontentmultimediageneral';\n\n            if (lastMessage.text.includes('<img')) {\n                pix = 'i/messagecontentimage';\n                label = 'messagecontentimage';\n            } else if (lastMessage.text.includes('<video')) {\n                pix = 'i/messagecontentvideo';\n                label = 'messagecontentvideo';\n            } else if (lastMessage.text.includes('<audio')) {\n                pix = 'i/messagecontentaudio';\n                label = 'messagecontentaudio';\n            }\n\n            try {\n                var labelString = await Str.get_string(label, 'core_message');\n                var icon = await Templates.renderPix(pix, 'core', labelString);\n                return icon + ' ' + labelString;\n            } catch (error) {\n                Notification.exception(error);\n                return null;\n            }\n        };\n\n        var mapPromises = conversations.map(function(conversation) {\n\n            var lastMessage = conversation.messages.length ? conversation.messages[conversation.messages.length - 1] : null;\n\n            return formatMessagePreview(lastMessage)\n                .then(function(messagePreview) {\n                    var formattedConversation = {\n                        id: conversation.id,\n                        imageurl: conversation.imageurl,\n                        name: conversation.name,\n                        subname: conversation.subname,\n                        unreadcount: conversation.unreadcount,\n                        ismuted: conversation.ismuted,\n                        lastmessagedate: lastMessage ? lastMessage.timecreated : null,\n                        sentfromcurrentuser: lastMessage ? lastMessage.useridfrom == userId : null,\n                        lastmessage: messagePreview\n                    };\n\n                    var otherUser = null;\n                    if (conversation.type == MessageDrawerViewConversationContants.CONVERSATION_TYPES.SELF) {\n                        // Self-conversations have only one member.\n                        otherUser = conversation.members[0];\n                    } else if (conversation.type == MessageDrawerViewConversationContants.CONVERSATION_TYPES.PRIVATE) {\n                        // For private conversations, remove the current userId from the members to get the other user.\n                        otherUser = conversation.members.reduce(function(carry, member) {\n                            if (!carry && member.id != userId) {\n                                carry = member;\n                            }\n                            return carry;\n                        }, null);\n                    }\n\n                    if (otherUser !== null) {\n                        formattedConversation.userid = otherUser.id;\n                        formattedConversation.showonlinestatus = otherUser.showonlinestatus;\n                        formattedConversation.isonline = otherUser.isonline;\n                        formattedConversation.isblocked = otherUser.isblocked;\n                    }\n\n                    if (conversation.type == MessageDrawerViewConversationContants.CONVERSATION_TYPES.PUBLIC) {\n                        formattedConversation.lastsendername = conversation.members.reduce(function(carry, member) {\n                            if (!carry && lastMessage && member.id == lastMessage.useridfrom) {\n                                carry = member.fullname;\n                            }\n                            return carry;\n                        }, null);\n                    }\n\n                    return formattedConversation;\n                }).catch(Notification.exception);\n        });\n\n        return Promise.all(mapPromises)\n            .then(function(formattedConversations) {\n                formattedConversations.forEach(function(conversation) {\n                    if (new Date().toDateString() == new Date(conversation.lastmessagedate * 1000).toDateString()) {\n                        conversation.istoday = true;\n                    }\n                });\n\n                return Templates.render(TEMPLATES.CONVERSATIONS_LIST, {conversations: formattedConversations});\n            }).then(function(html, js) {\n                pending.resolve();\n                return $.Deferred().resolve(html, js);\n            }).catch(function(error) {\n                pending.resolve();\n                Notification.exception(error);\n            });\n    };\n\n    /**\n     * Build the callback to load conversations.\n     *\n     * @param  {Array|null} types The conversation types for this section.\n     * @param  {bool} includeFavourites Include/exclude favourites.\n     * @param  {Number} offset Result offset\n     * @return {Function}\n     */\n    var getLoadCallback = function(types, includeFavourites, offset) {\n        // Note: This function is a bit messy because we've added the concept of loading\n        // multiple conversations types (e.g. private + self) at once but haven't properly\n        // updated the web service to accept an array of types. Instead we've added a new\n        // parameter for the self type which means we can only ever load self + other type.\n        // This should be improved to make it more extensible in the future. Adding new params\n        // for each type isn't very scalable.\n        var type = null;\n        // Include self conversations in the results by default.\n        var includeSelfConversations = true;\n        if (types && types.length) {\n            // Just get the conversation types that aren't \"self\" for now.\n            var nonSelfConversationTypes = types.filter(function(candidate) {\n                return candidate != MessageDrawerViewConversationContants.CONVERSATION_TYPES.SELF;\n            });\n            // If we're specifically asking for a list of types that doesn't include the self\n            // conversations then we don't need to include them.\n            includeSelfConversations = types.length != nonSelfConversationTypes.length;\n            // As mentioned above the webservice is currently limited to loading one type at a\n            // time (plus self conversations) so let's hope we never change this.\n            type = nonSelfConversationTypes[0];\n        }\n\n        return function(root, userId) {\n            return MessageRepository.getConversations(\n                    userId,\n                    type,\n                    LOAD_LIMIT + 1,\n                    offset,\n                    includeFavourites,\n                    includeSelfConversations\n                )\n                .then(function(response) {\n                    var conversations = response.conversations;\n\n                    if (conversations.length > LOAD_LIMIT) {\n                        conversations = conversations.slice(0, -1);\n                    } else {\n                        LazyLoadList.setLoadedAll(root, true);\n                    }\n\n                    offset = offset + LOAD_LIMIT;\n\n                    conversations.forEach(function(conversation) {\n                        loadedConversationsById[conversation.id] = conversation;\n                    });\n\n                    return conversations;\n                })\n                .catch(Notification.exception);\n        };\n    };\n\n    /**\n     * Get the total count container element.\n     *\n     * @param  {Object} root Overview messages container element.\n     * @return {Object} Total count container element.\n     */\n    var getTotalConversationCountElement = function(root) {\n        return root.find(SELECTORS.SECTION_TOTAL_COUNT);\n    };\n\n    /**\n     * Get the unread conversations count container element.\n     *\n     * @param  {Object} root Overview messages container element.\n     * @return {Object} Unread conversations count container element.\n     */\n    var getTotalUnreadConversationCountElement = function(root) {\n        return root.find(SELECTORS.SECTION_UNREAD_COUNT);\n    };\n\n    /**\n     * Increment the total conversations count.\n     *\n     * @param  {Object} root Overview messages container element.\n     */\n    var incrementTotalConversationCount = function(root) {\n        if (loadedTotalCounts) {\n            var element = getTotalConversationCountElement(root);\n            var count = parseInt(element.text());\n            count = count + 1;\n            element.text(count);\n        }\n    };\n\n    /**\n     * Decrement the total conversations count.\n     *\n     * @param  {Object} root Overview messages container element.\n     */\n    var decrementTotalConversationCount = function(root) {\n        if (loadedTotalCounts) {\n            var element = getTotalConversationCountElement(root);\n            var count = parseInt(element.text());\n            count = count - 1;\n            element.text(count);\n        }\n    };\n\n    /**\n     * Decrement the total unread conversations count.\n     *\n     * @param  {Object} root Overview messages container element.\n     */\n    var decrementTotalUnreadConversationCount = function(root) {\n        if (loadedUnreadCounts) {\n            var element = getTotalUnreadConversationCountElement(root);\n            var count = parseInt(element.text());\n            count = count - 1;\n            // Re-render the unread count.\n            renderUnreadCount(root, count);\n        }\n    };\n\n    /**\n     * Get a contact / conversation element.\n     *\n     * @param  {Object} root Overview messages container element.\n     * @param  {Number} conversationId The conversation id.\n     * @return {Object} Conversation element.\n     */\n    var getConversationElement = function(root, conversationId) {\n        return root.find('[data-conversation-id=\"' + conversationId + '\"]');\n    };\n\n    /**\n     * Get a contact / conversation element from a user id.\n     *\n     * @param  {Object} root Overview messages container element.\n     * @param  {Number} userId The user id.\n     * @return {Object} Conversation element.\n     */\n    var getConversationElementFromUserId = function(root, userId) {\n        return root.find('[data-user-id=\"' + userId + '\"]');\n    };\n\n    /**\n     * Show the conversation is muted icon.\n     *\n     * @param  {Object} conversationElement The conversation element.\n     */\n    var muteConversation = function(conversationElement) {\n        conversationElement.find(SELECTORS.MUTED_ICON_CONTAINER).removeClass('hidden');\n    };\n\n    /**\n     * Hide the conversation is muted icon.\n     *\n     * @param  {Object} conversationElement The conversation element.\n     */\n    var unmuteConversation = function(conversationElement) {\n        conversationElement.find(SELECTORS.MUTED_ICON_CONTAINER).addClass('hidden');\n    };\n\n    /**\n     * Show the contact is blocked icon.\n     *\n     * @param  {Object} conversationElement The conversation element.\n     */\n    var blockContact = function(conversationElement) {\n        conversationElement.find(SELECTORS.BLOCKED_ICON_CONTAINER).removeClass('hidden');\n    };\n\n    /**\n     * Hide the contact is blocked icon.\n     *\n     * @param  {Object} conversationElement The conversation element.\n     */\n    var unblockContact = function(conversationElement) {\n        conversationElement.find(SELECTORS.BLOCKED_ICON_CONTAINER).addClass('hidden');\n    };\n\n    /**\n     * Create an render new conversation element in the list of conversations.\n     *\n     * @param  {Object} root Overview messages container element.\n     * @param  {Object} conversation The conversation.\n     * @param  {Number} userId The logged in user id.\n     * @return {Object} jQuery promise\n     */\n    var createNewConversationFromEvent = function(root, conversation, userId) {\n        var existingConversations = root.find(SELECTORS.CONVERSATION);\n\n        if (!existingConversations.length) {\n            // If we didn't have any conversations then we need to show\n            // the content of the list and hide the empty message.\n            var listRoot = LazyLoadList.getRoot(root);\n            LazyLoadList.showContent(listRoot);\n            LazyLoadList.hideEmptyMessage(listRoot);\n        }\n\n        // Cache the conversation.\n        loadedConversationsById[conversation.id] = conversation;\n\n        return render([conversation], userId)\n            .then(function(html) {\n                var contentContainer = LazyLoadList.getContentContainer(root);\n                return contentContainer.prepend(html);\n            })\n            .then(function() {\n                return incrementTotalConversationCount(root);\n            })\n            .catch(Notification.exception);\n    };\n\n    /**\n     * Delete a conversation from the list of conversations.\n     *\n     * @param  {Object} root Overview messages container element.\n     * @param  {Object} conversationElement The conversation element.\n     */\n    var deleteConversation = function(root, conversationElement) {\n        conversationElement.remove();\n        decrementTotalConversationCount(root);\n\n        var conversations = root.find(SELECTORS.CONVERSATION);\n        if (!conversations.length) {\n            // If we don't have any conversations then we need to hide\n            // the content of the list and show the empty message.\n            var listRoot = LazyLoadList.getRoot(root);\n            LazyLoadList.hideContent(listRoot);\n            LazyLoadList.showEmptyMessage(listRoot);\n        }\n    };\n\n    /**\n     * Mark a conversation as read.\n     *\n     * @param  {Object} root Overview messages container element.\n     * @param  {Object} conversationElement The conversation element.\n     */\n    var markConversationAsRead = function(root, conversationElement) {\n        var unreadCount = conversationElement.find(SELECTORS.UNREAD_COUNT);\n        unreadCount.text('0');\n        unreadCount.addClass('hidden');\n        decrementTotalUnreadConversationCount(root);\n    };\n\n    /**\n     * Listen to, and handle events in this section.\n     *\n     * @param {String} namespace Unique identifier for the Routes\n     * @param {Object} root The section container element.\n     * @param {Function} loadCallback The callback to load items.\n     * @param {Array|null} types The conversation types for this section\n     * @param {bool} includeFavourites If this section includes favourites\n     * @param {String} fromPanel Routing argument to send if the section is loaded in message index left panel.\n     */\n    var registerEventListeners = function(namespace, root, loadCallback, types, includeFavourites, fromPanel) {\n        var listRoot = LazyLoadList.getRoot(root);\n        var conversationBelongsToThisSection = function(conversation) {\n            // Make sure the type is an int so that the index of check matches correctly.\n            var conversationType = parseInt(conversation.type, 10);\n            if (\n                // If the conversation type isn't one this section cares about then we can ignore it.\n                (types && types.indexOf(conversationType) < 0) ||\n                // If this is the favourites section and the conversation isn't a favourite then ignore it.\n                (includeFavourites && !conversation.isFavourite) ||\n                // If this section doesn't include favourites and the conversation is a favourite then ignore it.\n                (!includeFavourites && conversation.isFavourite)\n            ) {\n                return false;\n            }\n\n            return true;\n        };\n\n\n        root[0].addEventListener('show.bs.collapse', function() {\n            setExpanded(root);\n            LazyLoadList.show(listRoot, loadCallback, function(contentContainer, conversations, userId) {\n                return render(conversations, userId)\n                    .then(function(html) {\n                        contentContainer.append(html);\n                        return html;\n                    })\n                    .catch(Notification.exception);\n            });\n        });\n\n        root[0].addEventListener('hidden.bs.collapse', function() {\n            setCollapsed(root);\n        });\n\n        PubSub.subscribe(MessageDrawerEvents.CONTACT_BLOCKED, function(userId) {\n            var conversationElement = getConversationElementFromUserId(root, userId);\n            if (conversationElement.length) {\n                blockContact(conversationElement);\n            }\n        });\n\n        PubSub.subscribe(MessageDrawerEvents.CONTACT_UNBLOCKED, function(userId) {\n            var conversationElement = getConversationElementFromUserId(root, userId);\n\n            if (conversationElement.length) {\n                unblockContact(conversationElement);\n            }\n        });\n\n        PubSub.subscribe(MessageDrawerEvents.CONVERSATION_SET_MUTED, function(conversation) {\n            var conversationId = conversation.id;\n            var conversationElement = getConversationElement(root, conversationId);\n            if (conversationElement.length) {\n                muteConversation(conversationElement);\n            }\n        });\n\n        PubSub.subscribe(MessageDrawerEvents.CONVERSATION_UNSET_MUTED, function(conversation) {\n            var conversationId = conversation.id;\n            var conversationElement = getConversationElement(root, conversationId);\n            if (conversationElement.length) {\n                unmuteConversation(conversationElement);\n            }\n        });\n\n        PubSub.subscribe(MessageDrawerEvents.CONVERSATION_NEW_LAST_MESSAGE, function(conversation) {\n            if (!conversationBelongsToThisSection(conversation)) {\n                return;\n            }\n\n            var pendingPromise = new Pending('core_message/message_drawer_view_overview_section:new');\n            var loggedInUserId = conversation.loggedInUserId;\n            var conversationId = conversation.id;\n            var element = getConversationElement(root, conversationId);\n            conversation = formatConversationFromEvent(conversation);\n            if (element.length) {\n                var contentContainer = LazyLoadList.getContentContainer(root);\n                render([conversation], loggedInUserId)\n                    .then(function(html) {\n                        if (deletedConversationsById[conversationId]) {\n                            // This conversation was deleted at some point since the messaging drawer was created.\n                            if (conversation.messages[0].timeadded < deletedConversationsById[conversationId]) {\n                                // The 'new' message was added before the conversation was deleted.\n                                // This is probably stale data.\n                                return;\n                            }\n                        }\n                        contentContainer.prepend(html);\n                        element.remove();\n\n                        return;\n                    })\n                    .then(pendingPromise.resolve)\n                    .catch(Notification.exception);\n            } else if (conversation.messages.length) {\n                createNewConversationFromEvent(root, conversation, loggedInUserId)\n                .then(pendingPromise.resolve)\n                .catch();\n            } else {\n                pendingPromise.resolve();\n            }\n        });\n\n        PubSub.subscribe(MessageDrawerEvents.CONVERSATION_DELETED, function(conversationId) {\n            var conversationElement = getConversationElement(root, conversationId);\n            delete loadedConversationsById[conversationId];\n            deletedConversationsById[conversationId] = new Date();\n            if (conversationElement.length) {\n                deleteConversation(root, conversationElement);\n            }\n        });\n\n        PubSub.subscribe(MessageDrawerEvents.CONVERSATION_READ, function(conversationId) {\n            var conversationElement = getConversationElement(root, conversationId);\n            if (conversationElement.length) {\n                markConversationAsRead(root, conversationElement);\n            }\n        });\n\n        PubSub.subscribe(MessageDrawerEvents.CONVERSATION_SET_FAVOURITE, function(conversation) {\n            var conversationElement = null;\n            if (conversationBelongsToThisSection(conversation)) {\n                conversationElement = getConversationElement(root, conversation.id);\n                if (!conversationElement.length) {\n                    createNewConversationFromEvent(\n                        root,\n                        formatConversationFromEvent(conversation),\n                        conversation.loggedInUserId\n                    );\n                }\n            } else {\n                conversationElement = getConversationElement(root, conversation.id);\n                if (conversationElement.length) {\n                    deleteConversation(root, conversationElement);\n                }\n            }\n        });\n\n        PubSub.subscribe(MessageDrawerEvents.CONVERSATION_UNSET_FAVOURITE, function(conversation) {\n            var conversationElement = null;\n            if (conversationBelongsToThisSection(conversation)) {\n                conversationElement = getConversationElement(root, conversation.id);\n                if (!conversationElement.length) {\n                    createNewConversationFromEvent(\n                        root,\n                        formatConversationFromEvent(conversation),\n                        conversation.loggedInUserId\n                    );\n                }\n            } else {\n                conversationElement = getConversationElement(root, conversation.id);\n                if (conversationElement.length) {\n                    deleteConversation(root, conversationElement);\n                }\n            }\n        });\n\n        CustomEvents.define(root, [CustomEvents.events.activate]);\n        root.on(CustomEvents.events.activate, SELECTORS.CONVERSATION, function(e, data) {\n            var conversationElement = $(e.target).closest(SELECTORS.CONVERSATION);\n            var conversationId = conversationElement.attr('data-conversation-id');\n            var conversation = loadedConversationsById[conversationId];\n            MessageDrawerRouter.go(namespace, MessageDrawerRoutes.VIEW_CONVERSATION, conversation, fromPanel);\n\n            data.originalEvent.preventDefault();\n        });\n    };\n\n    /**\n     * Setup the section.\n     *\n     * @param {String} namespace Unique identifier for the Routes\n     * @param {Object} header The header container element.\n     * @param {Object} body The section container element.\n     * @param {Object} footer The footer container element.\n     * @param {Array} types The conversation types that show in this section\n     * @param {bool} includeFavourites If this section includes favourites\n     * @param {Object} totalCountPromise Resolves wth the total conversations count\n     * @param {Object} unreadCountPromise Resolves wth the unread conversations count\n     * @param {bool} fromPanel shown in message app panel.\n     */\n    var show = function(namespace, header, body, footer, types, includeFavourites, totalCountPromise, unreadCountPromise,\n        fromPanel) {\n        var root = $(body);\n\n        if (!root.attr('data-init')) {\n            var loadCallback = getLoadCallback(types, includeFavourites, 0);\n            registerEventListeners(namespace, root, loadCallback, types, includeFavourites, fromPanel);\n\n            if (isVisible(root)) {\n                setExpanded(root);\n                var listRoot = LazyLoadList.getRoot(root);\n                LazyLoadList.show(listRoot, loadCallback, function(contentContainer, conversations, userId) {\n                    return render(conversations, userId)\n                        .then(function(html) {\n                            contentContainer.append(html);\n                            return html;\n                        })\n                        .catch(Notification.exception);\n                });\n            }\n\n            // This is given to us by the calling code because the total counts for all sections\n            // are loaded in a single ajax request rather than one request per section.\n            totalCountPromise.then(function(count) {\n                renderTotalCount(root, count);\n                loadedTotalCounts = true;\n                return;\n            })\n            .catch(function() {\n                // Silently ignore if we can't updated the counts. No need to bother the user.\n            });\n\n            // This is given to us by the calling code because the unread counts for all sections\n            // are loaded in a single ajax request rather than one request per section.\n            unreadCountPromise.then(function(count) {\n                renderUnreadCount(root, count);\n                loadedUnreadCounts = true;\n                return;\n            })\n            .catch(function() {\n                // Silently ignore if we can't updated the counts. No need to bother the user.\n            });\n\n            root.attr('data-init', true);\n        }\n    };\n\n    return {\n        show: show,\n        isVisible: isVisible\n    };\n});\n"],"names":["define","$","CustomEvents","Notification","PubSub","Str","Pending","Templates","UserDate","MessageRepository","MessageDrawerEvents","MessageDrawerRouter","MessageDrawerRoutes","LazyLoadList","MessageDrawerViewConversationContants","SELECTORS","TEMPLATES","loadedConversationsById","deletedConversationsById","loadedTotalCounts","loadedUnreadCounts","isVisible","root","getRoot","hasClass","setExpanded","addClass","renderUnreadCount","count","container","find","text","get_string","done","string","attr","removeClass","formatConversationFromEvent","conversation","recursivelyLowercaseKeys","object","Object","keys","reduce","carry","key","isArray","toLowerCase","map","formatted","messages","message","useridfrom","userfrom","id","render","conversations","userId","pending","mapPromises","lastMessage","length","async","tmpElement","document","createElement","innerHTML","replace","querySelector","messagePreview","indexOf","pix","label","includes","labelString","renderPix","error","exception","formatMessagePreview","then","formattedConversation","imageurl","name","subname","unreadcount","ismuted","lastmessagedate","timecreated","sentfromcurrentuser","lastmessage","otherUser","type","CONVERSATION_TYPES","SELF","members","PRIVATE","member","userid","showonlinestatus","isonline","isblocked","PUBLIC","lastsendername","fullname","catch","Promise","all","formattedConversations","forEach","Date","toDateString","istoday","html","js","resolve","Deferred","getTotalConversationCountElement","decrementTotalUnreadConversationCount","element","getTotalUnreadConversationCountElement","parseInt","getConversationElement","conversationId","getConversationElementFromUserId","createNewConversationFromEvent","listRoot","showContent","hideEmptyMessage","getContentContainer","prepend","incrementTotalConversationCount","deleteConversation","conversationElement","remove","decrementTotalConversationCount","hideContent","showEmptyMessage","registerEventListeners","namespace","loadCallback","types","includeFavourites","fromPanel","conversationBelongsToThisSection","conversationType","isFavourite","addEventListener","show","contentContainer","append","setCollapsed","subscribe","CONTACT_BLOCKED","blockContact","CONTACT_UNBLOCKED","unblockContact","CONVERSATION_SET_MUTED","muteConversation","CONVERSATION_UNSET_MUTED","unmuteConversation","CONVERSATION_NEW_LAST_MESSAGE","pendingPromise","loggedInUserId","timeadded","CONVERSATION_DELETED","CONVERSATION_READ","unreadCount","markConversationAsRead","CONVERSATION_SET_FAVOURITE","CONVERSATION_UNSET_FAVOURITE","events","activate","on","e","data","target","closest","go","VIEW_CONVERSATION","originalEvent","preventDefault","header","body","footer","totalCountPromise","unreadCountPromise","offset","includeSelfConversations","nonSelfConversationTypes","filter","candidate","getConversations","LOAD_LIMIT","response","slice","setLoadedAll","getLoadCallback","numPlaceholders","placeholders","Array","apply","renderTotalCount"],"mappings":";;;;;;;AAsBAA,2DACA,CACI,SACA,iCACA,oBACA,cACA,WACA,eACA,iBACA,iBACA,kC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