Proyectos de Subversion Moodle

Rev

Autoría | 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        }\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            element.text(count);\n\n            if (count < 1) {\n                element.addClass('hidden');\n            }\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        // Set the minimum height of the section to the height of the toggle. This\n        // smooths out the collapse animation.\n        var toggle = root.find(SELECTORS.TOGGLE);\n        root.css('min-height', toggle.outerHeight());\n\n        root.on('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.on('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","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","text","replace","querySelector","messagePreview","indexOf","pix","label","includes","labelString","get_string","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","find","decrementTotalUnreadConversationCount","element","getTotalUnreadConversationCountElement","count","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","toggle","css","outerHeight","on","show","contentContainer","append","removeClass","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","e","data","target","closest","attr","go","VIEW_CONVERSATION","originalEvent","preventDefault","header","body","footer","totalCountPromise","unreadCountPromise","offset","includeSelfConversations","nonSelfConversationTypes","filter","candidate","getConversations","LOAD_LIMIT","response","slice","setLoadedAll","getLoadCallback","container","done","string","numPlaceholders","placeholders","Array","apply","renderTotalCount","renderUnreadCount"],"mappings":";;;;;;;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