diff --git a/message/amd/build/message_drawer_view_overview_section.min.js b/message/amd/build/message_drawer_view_overview_section.min.js index 5271dc11f84..c6daf6ffc44 100644 --- a/message/amd/build/message_drawer_view_overview_section.min.js +++ b/message/amd/build/message_drawer_view_overview_section.min.js @@ -1,2 +1,2 @@ -function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var h=a.apply(b,c);function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}f(void 0)})}}define ("core_message/message_drawer_view_overview_section",["jquery","core/custom_interaction_events","core/notification","core/pubsub","core/str","core/pending","core/templates","core/user_date","core_message/message_repository","core_message/message_drawer_events","core_message/message_drawer_router","core_message/message_drawer_routes","core_message/message_drawer_lazy_load_list","core_message/message_drawer_view_conversation_constants"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){var o={TOGGLE:"[data-region=\"toggle\"]",CONVERSATION:"[data-conversation-id]",BLOCKED_ICON_CONTAINER:"[data-region=\"contact-icon-blocked\"]",LAST_MESSAGE:"[data-region=\"last-message\"]",LAST_MESSAGE_DATE:"[data-region=\"last-message-date\"]",MUTED_ICON_CONTAINER:"[data-region=\"muted-icon-container\"]",UNREAD_COUNT:"[data-region=\"unread-count\"]",SECTION_TOTAL_COUNT:"[data-region=\"section-total-count\"]",SECTION_TOTAL_COUNT_CONTAINER:"[data-region=\"section-total-count-container\"]",SECTION_UNREAD_COUNT:"[data-region=\"section-unread-count\"]",PLACEHOLDER_CONTAINER:"[data-region=\"placeholder-container\"]"},p={CONVERSATIONS_LIST:"core_message/message_drawer_conversations_list",CONVERSATIONS_LIST_ITEMS_PLACEHOLDER:"core_message/message_drawer_conversations_list_items_placeholder"},q=50,r={},s=!1,t=!1,u=function(a){return m.getRoot(a).hasClass("show")},v=function(a){a.addClass("expanded")},w=function(a){a.removeClass("expanded")},x=function(a,b){var c=a.find(o.SECTION_TOTAL_COUNT_CONTAINER),d=c.find(o.SECTION_TOTAL_COUNT);d.text(b);c.removeClass("hidden");e.get_string("totalconversations","core_message",b).done(function(a){c.attr("aria-label",a)});var f=20q){c=c.slice(0,-1)}else{m.setLoadedAll(a,!0)}d=d+q;c.forEach(function(a){r[a.id]=a});return c}).catch(c.exception)}},C=function(a){return a.find(o.SECTION_TOTAL_COUNT)},D=function(a){return a.find(o.SECTION_UNREAD_COUNT)},E=function(a){if(s){var b=C(a),c=parseInt(b.text());c=c+1;b.text(c)}},F=function(a){if(s){var b=C(a),c=parseInt(b.text());c=c-1;b.text(c)}},G=function(a){if(t){var b=D(a),c=parseInt(b.text());c=c-1;b.text(c);if(1>c){b.addClass("hidden")}}},H=function(a,b){return a.find("[data-conversation-id=\""+b+"\"]")},I=function(a,b){return a.find("[data-user-id=\""+b+"\"]")},J=function(a){a.find(o.MUTED_ICON_CONTAINER).removeClass("hidden")},K=function(a){a.find(o.MUTED_ICON_CONTAINER).addClass("hidden")},L=function(a){a.find(o.BLOCKED_ICON_CONTAINER).removeClass("hidden")},M=function(a){a.find(o.BLOCKED_ICON_CONTAINER).addClass("hidden")},N=function(a,b,d){var e=a.find(o.CONVERSATION);if(!e.length){var f=m.getRoot(a);m.showContent(f);m.hideEmptyMessage(f)}r[b.id]=b;return A([b],d).then(function(b){var c=m.getContentContainer(a);return c.prepend(b)}).then(function(){return E(a)}).catch(c.exception)},O=function(a,b){b.remove();F(a);var c=a.find(o.CONVERSATION);if(!c.length){var d=m.getRoot(a);m.hideContent(d);m.showEmptyMessage(d)}},P=function(a,b){var c=b.find(o.UNREAD_COUNT);c.text("0");c.addClass("hidden");G(a)},Q=function(f,g,h,i,n,p){var q=m.getRoot(g),s=function(a){var b=parseInt(a.type,10);if(i&&0>i.indexOf(b)||n&&!a.isFavourite||!n&&a.isFavourite){return!1}return!0},t=g.find(o.TOGGLE);g.css("min-height",t.outerHeight());g.on("show.bs.collapse",function(){v(g);m.show(q,h,function(a,b,d){return A(b,d).then(function(b){a.append(b);return b}).catch(c.exception)})});g.on("hidden.bs.collapse",function(){w(g)});d.subscribe(j.CONTACT_BLOCKED,function(a){var b=I(g,a);if(b.length){L(b)}});d.subscribe(j.CONTACT_UNBLOCKED,function(a){var b=I(g,a);if(b.length){M(b)}});d.subscribe(j.CONVERSATION_SET_MUTED,function(a){var b=a.id,c=H(g,b);if(c.length){J(c)}});d.subscribe(j.CONVERSATION_UNSET_MUTED,function(a){var b=a.id,c=H(g,b);if(c.length){K(c)}});d.subscribe(j.CONVERSATION_NEW_LAST_MESSAGE,function(a){if(!s(a)){return}var b=a.loggedInUserId,d=a.id,e=H(g,d);a=z(a);if(e.length){var f=m.getContentContainer(g);A([a],b).then(function(a){f.prepend(a);e.remove();return a}).catch(c.exception)}else{N(g,a,b)}});d.subscribe(j.CONVERSATION_DELETED,function(a){var b=H(g,a);delete r[a];if(b.length){O(g,b)}});d.subscribe(j.CONVERSATION_READ,function(a){var b=H(g,a);if(b.length){P(g,b)}});d.subscribe(j.CONVERSATION_SET_FAVOURITE,function(a){var b=null;if(s(a)){b=H(g,a.id);if(!b.length){N(g,z(a),a.loggedInUserId)}}else{b=H(g,a.id);if(b.length){O(g,b)}}});d.subscribe(j.CONVERSATION_UNSET_FAVOURITE,function(a){var b=null;if(s(a)){b=H(g,a.id);if(!b.length){N(g,z(a),a.loggedInUserId)}}else{b=H(g,a.id);if(b.length){O(g,b)}}});b.define(g,[b.events.activate]);g.on(b.events.activate,o.CONVERSATION,function(b,c){var d=a(b.target).closest(o.CONVERSATION),e=d.attr("data-conversation-id"),g=r[e];k.go(f,l.VIEW_CONVERSATION,g,p);c.originalEvent.preventDefault()})};return{show:function show(b,d,e,f,g,h,i,j,k){var l=a(e);if(!l.attr("data-init")){var n=B(g,h,0);Q(b,l,n,g,h,k);if(u(l)){v(l);var o=m.getRoot(l);m.show(o,n,function(a,b,d){return A(b,d).then(function(b){a.append(b);return b}).catch(c.exception)})}i.then(function(a){x(l,a);s=!0}).catch(function(){});j.then(function(a){y(l,a);t=!0}).catch(function(){});l.attr("data-init",!0)}},isVisible:u}}); +function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var h=a.apply(b,c);function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}f(void 0)})}}define ("core_message/message_drawer_view_overview_section",["jquery","core/custom_interaction_events","core/notification","core/pubsub","core/str","core/pending","core/templates","core/user_date","core_message/message_repository","core_message/message_drawer_events","core_message/message_drawer_router","core_message/message_drawer_routes","core_message/message_drawer_lazy_load_list","core_message/message_drawer_view_conversation_constants"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){var o={TOGGLE:"[data-region=\"toggle\"]",CONVERSATION:"[data-conversation-id]",BLOCKED_ICON_CONTAINER:"[data-region=\"contact-icon-blocked\"]",LAST_MESSAGE:"[data-region=\"last-message\"]",LAST_MESSAGE_DATE:"[data-region=\"last-message-date\"]",MUTED_ICON_CONTAINER:"[data-region=\"muted-icon-container\"]",UNREAD_COUNT:"[data-region=\"unread-count\"]",SECTION_TOTAL_COUNT:"[data-region=\"section-total-count\"]",SECTION_TOTAL_COUNT_CONTAINER:"[data-region=\"section-total-count-container\"]",SECTION_UNREAD_COUNT:"[data-region=\"section-unread-count\"]",PLACEHOLDER_CONTAINER:"[data-region=\"placeholder-container\"]"},p={CONVERSATIONS_LIST:"core_message/message_drawer_conversations_list",CONVERSATIONS_LIST_ITEMS_PLACEHOLDER:"core_message/message_drawer_conversations_list_items_placeholder"},q=50,r={},s=!1,t=!1,u=function(a){return m.getRoot(a).hasClass("show")},v=function(a){a.addClass("expanded")},w=function(a){a.removeClass("expanded")},x=function(a,b){var c=a.find(o.SECTION_TOTAL_COUNT_CONTAINER),d=c.find(o.SECTION_TOTAL_COUNT);d.text(b);c.removeClass("hidden");e.get_string("totalconversations","core_message",b).done(function(a){c.attr("aria-label",a)});var f=20q){c=c.slice(0,-1)}else{m.setLoadedAll(a,!0)}d=d+q;c.forEach(function(a){r[a.id]=a});return c}).catch(c.exception)}},C=function(a){return a.find(o.SECTION_TOTAL_COUNT)},D=function(a){return a.find(o.SECTION_UNREAD_COUNT)},E=function(a){if(s){var b=C(a),c=parseInt(b.text());c=c+1;b.text(c)}},F=function(a){if(s){var b=C(a),c=parseInt(b.text());c=c-1;b.text(c)}},G=function(a){if(t){var b=D(a),c=parseInt(b.text());c=c-1;b.text(c);if(1>c){b.addClass("hidden")}}},H=function(a,b){return a.find("[data-conversation-id=\""+b+"\"]")},I=function(a,b){return a.find("[data-user-id=\""+b+"\"]")},J=function(a){a.find(o.MUTED_ICON_CONTAINER).removeClass("hidden")},K=function(a){a.find(o.MUTED_ICON_CONTAINER).addClass("hidden")},L=function(a){a.find(o.BLOCKED_ICON_CONTAINER).removeClass("hidden")},M=function(a){a.find(o.BLOCKED_ICON_CONTAINER).addClass("hidden")},N=function(a,b,d){var e=a.find(o.CONVERSATION);if(!e.length){var f=m.getRoot(a);m.showContent(f);m.hideEmptyMessage(f)}r[b.id]=b;return A([b],d).then(function(b){var c=m.getContentContainer(a);return c.prepend(b)}).then(function(){return E(a)}).catch(c.exception)},O=function(a,b){b.remove();F(a);var c=a.find(o.CONVERSATION);if(!c.length){var d=m.getRoot(a);m.hideContent(d);m.showEmptyMessage(d)}},P=function(a,b){var c=b.find(o.UNREAD_COUNT);c.text("0");c.addClass("hidden");G(a)},Q=function(f,g,h,i,n,p){var q=m.getRoot(g),s=function(a){var b=parseInt(a.type,10);if(i&&0>i.indexOf(b)||n&&!a.isFavourite||!n&&a.isFavourite){return!1}return!0},t=g.find(o.TOGGLE);g.css("min-height",t.outerHeight());g.on("show.bs.collapse",function(){v(g);m.show(q,h,function(a,b,d){return A(b,d).then(function(b){a.append(b);return b}).catch(c.exception)})});g.on("hidden.bs.collapse",function(){w(g)});d.subscribe(j.CONTACT_BLOCKED,function(a){var b=I(g,a);if(b.length){L(b)}});d.subscribe(j.CONTACT_UNBLOCKED,function(a){var b=I(g,a);if(b.length){M(b)}});d.subscribe(j.CONVERSATION_SET_MUTED,function(a){var b=a.id,c=H(g,b);if(c.length){J(c)}});d.subscribe(j.CONVERSATION_UNSET_MUTED,function(a){var b=a.id,c=H(g,b);if(c.length){K(c)}});d.subscribe(j.CONVERSATION_NEW_LAST_MESSAGE,function(a){if(!s(a)){return}var b=a.loggedInUserId,d=a.id,e=H(g,d);a=z(a);if(e.length){var f=m.getContentContainer(g);A([a],b).then(function(a){f.prepend(a);e.remove();return a}).catch(c.exception)}else{N(g,a,b)}});d.subscribe(j.CONVERSATION_DELETED,function(a){var b=H(g,a);delete r[a];if(b.length){O(g,b)}});d.subscribe(j.CONVERSATION_READ,function(a){var b=H(g,a);if(b.length){P(g,b)}});d.subscribe(j.CONVERSATION_SET_FAVOURITE,function(a){var b=null;if(s(a)){b=H(g,a.id);if(!b.length){N(g,z(a),a.loggedInUserId)}}else{b=H(g,a.id);if(b.length){O(g,b)}}});d.subscribe(j.CONVERSATION_UNSET_FAVOURITE,function(a){var b=null;if(s(a)){b=H(g,a.id);if(!b.length){N(g,z(a),a.loggedInUserId)}}else{b=H(g,a.id);if(b.length){O(g,b)}}});b.define(g,[b.events.activate]);g.on(b.events.activate,o.CONVERSATION,function(b,c){var d=a(b.target).closest(o.CONVERSATION),e=d.attr("data-conversation-id"),g=r[e];k.go(f,l.VIEW_CONVERSATION,g,p);c.originalEvent.preventDefault()})};return{show:function show(b,d,e,f,g,h,i,j,k){var l=a(e);if(!l.attr("data-init")){var n=B(g,h,0);Q(b,l,n,g,h,k);if(u(l)){v(l);var o=m.getRoot(l);m.show(o,n,function(a,b,d){return A(b,d).then(function(b){a.append(b);return b}).catch(c.exception)})}i.then(function(a){x(l,a);s=!0}).catch(function(){});j.then(function(a){y(l,a);t=!0}).catch(function(){});l.attr("data-init",!0)}},isVisible:u}}); //# sourceMappingURL=message_drawer_view_overview_section.min.js.map diff --git a/message/amd/build/message_drawer_view_overview_section.min.js.map b/message/amd/build/message_drawer_view_overview_section.min.js.map index 32de90f70a6..1331bfd482b 100644 --- a/message/amd/build/message_drawer_view_overview_section.min.js.map +++ b/message/amd/build/message_drawer_view_overview_section.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/message_drawer_view_overview_section.js"],"names":["define","$","CustomEvents","Notification","PubSub","Str","Pending","Templates","UserDate","MessageRepository","MessageDrawerEvents","MessageDrawerRouter","MessageDrawerRoutes","LazyLoadList","MessageDrawerViewConversationContants","SELECTORS","TOGGLE","CONVERSATION","BLOCKED_ICON_CONTAINER","LAST_MESSAGE","LAST_MESSAGE_DATE","MUTED_ICON_CONTAINER","UNREAD_COUNT","SECTION_TOTAL_COUNT","SECTION_TOTAL_COUNT_CONTAINER","SECTION_UNREAD_COUNT","PLACEHOLDER_CONTAINER","TEMPLATES","CONVERSATIONS_LIST","CONVERSATIONS_LIST_ITEMS_PLACEHOLDER","LOAD_LIMIT","loadedConversationsById","loadedTotalCounts","loadedUnreadCounts","isVisible","root","getRoot","hasClass","setExpanded","addClass","setCollapsed","removeClass","renderTotalCount","count","container","find","countElement","text","get_string","done","string","attr","numPlaceholders","placeholders","Array","apply","map","render","then","html","placeholderContainer","catch","renderUnreadCount","formatConversationFromEvent","conversation","recursivelyLowercaseKeys","object","Object","keys","reduce","carry","key","isArray","toLowerCase","formatted","messages","message","useridfrom","userfrom","id","conversations","userId","pending","formatMessagePreview","lastMessage","tmpElement","document","createElement","innerHTML","replace","isMedia","querySelector","messagePreview","pix","label","includes","labelString","renderPix","icon","exception","mapPromises","length","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","Promise","all","formattedConversations","forEach","Date","toDateString","istoday","js","resolve","Deferred","error","getLoadCallback","types","includeFavourites","offset","includeSelfConversations","nonSelfConversationTypes","filter","candidate","getConversations","response","slice","setLoadedAll","getTotalConversationCountElement","getTotalUnreadConversationCountElement","incrementTotalConversationCount","element","parseInt","decrementTotalConversationCount","decrementTotalUnreadConversationCount","getConversationElement","conversationId","getConversationElementFromUserId","muteConversation","conversationElement","unmuteConversation","blockContact","unblockContact","createNewConversationFromEvent","existingConversations","listRoot","showContent","hideEmptyMessage","contentContainer","getContentContainer","prepend","deleteConversation","remove","hideContent","showEmptyMessage","markConversationAsRead","unreadCount","registerEventListeners","namespace","loadCallback","fromPanel","conversationBelongsToThisSection","conversationType","indexOf","isFavourite","toggle","css","outerHeight","on","show","append","subscribe","CONTACT_BLOCKED","CONTACT_UNBLOCKED","CONVERSATION_SET_MUTED","CONVERSATION_UNSET_MUTED","CONVERSATION_NEW_LAST_MESSAGE","loggedInUserId","CONVERSATION_DELETED","CONVERSATION_READ","CONVERSATION_SET_FAVOURITE","CONVERSATION_UNSET_FAVOURITE","events","activate","e","data","target","closest","go","VIEW_CONVERSATION","originalEvent","preventDefault","header","body","footer","totalCountPromise","unreadCountPromise"],"mappings":"kYAsBAA,OAAM,qDACN,CACI,QADJ,CAEI,gCAFJ,CAGI,mBAHJ,CAII,aAJJ,CAKI,UALJ,CAMI,cANJ,CAOI,gBAPJ,CAQI,gBARJ,CASI,iCATJ,CAUI,oCAVJ,CAWI,oCAXJ,CAYI,oCAZJ,CAaI,4CAbJ,CAcI,yDAdJ,CADM,CAiBN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYIC,CAZJ,CAaIC,CAbJ,CAcIC,CAdJ,CAeE,IAEMC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,CAAY,CAACuB,OAAb,CAAqBD,CAArB,CAAf,CACAtB,CAAY,CAACiL,IAAb,CAAkBxB,CAAlB,CAA4Bc,CAA5B,CAA0C,SAASX,CAAT,CAA2BzF,CAA3B,CAA0CC,CAA1C,CAAkD,CACxF,MAAOxB,CAAAA,CAAM,CAACuB,CAAD,CAAgBC,CAAhB,CAAN,CACFvB,IADE,CACG,SAASC,CAAT,CAAe,CACjB8G,CAAgB,CAACsB,MAAjB,CAAwBpI,CAAxB,EACA,MAAOA,CAAAA,CACV,CAJE,EAKFE,KALE,CAKI1D,CAAY,CAACgG,SALjB,CAMV,CAPD,CAQH,CAIDqH,CAAiB,CAAC9J,IAAlB,CAAuB,SAASf,CAAT,CAAgB,CACnCD,CAAgB,CAACP,CAAD,CAAOQ,CAAP,CAAhB,CACAX,CAAiB,GAEpB,CAJD,EAKC6B,KALD,CAKO,UAAW,CAEjB,CAPD,EAWA4J,CAAkB,CAAC/J,IAAnB,CAAwB,SAASf,CAAT,CAAgB,CACpCmB,CAAiB,CAAC3B,CAAD,CAAOQ,CAAP,CAAjB,CACAV,CAAkB,GAErB,CAJD,EAKC4B,KALD,CAKO,UAAW,CAEjB,CAPD,EASA1B,CAAI,CAACgB,IAAL,CAAU,WAAV,IACH,CACJ,CAEM,CAEHjB,SAAS,CAAEA,CAFR,CAIV,CAjxBK,CAAN","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 .\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 \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 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 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-label', 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 countElement = root.find(SELECTORS.SECTION_UNREAD_COUNT);\n countElement.text(count);\n\n Str.get_string('unreadconversations', 'core_message', count).done(function(string) {\n countElement.attr('aria-label', string);\n });\n\n if (count > 0) {\n countElement.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 {Object} contentContainer Conversations content container.\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 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 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 contentContainer.prepend(html);\n element.remove();\n return html;\n })\n .catch(Notification.exception);\n } else {\n createNewConversationFromEvent(root, conversation, loggedInUserId);\n }\n });\n\n PubSub.subscribe(MessageDrawerEvents.CONVERSATION_DELETED, function(conversationId) {\n var conversationElement = getConversationElement(root, conversationId);\n delete loadedConversationsById[conversationId];\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"],"file":"message_drawer_view_overview_section.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/message_drawer_view_overview_section.js"],"names":["define","$","CustomEvents","Notification","PubSub","Str","Pending","Templates","UserDate","MessageRepository","MessageDrawerEvents","MessageDrawerRouter","MessageDrawerRoutes","LazyLoadList","MessageDrawerViewConversationContants","SELECTORS","TOGGLE","CONVERSATION","BLOCKED_ICON_CONTAINER","LAST_MESSAGE","LAST_MESSAGE_DATE","MUTED_ICON_CONTAINER","UNREAD_COUNT","SECTION_TOTAL_COUNT","SECTION_TOTAL_COUNT_CONTAINER","SECTION_UNREAD_COUNT","PLACEHOLDER_CONTAINER","TEMPLATES","CONVERSATIONS_LIST","CONVERSATIONS_LIST_ITEMS_PLACEHOLDER","LOAD_LIMIT","loadedConversationsById","loadedTotalCounts","loadedUnreadCounts","isVisible","root","getRoot","hasClass","setExpanded","addClass","setCollapsed","removeClass","renderTotalCount","count","container","find","countElement","text","get_string","done","string","attr","numPlaceholders","placeholders","Array","apply","map","render","then","html","placeholderContainer","catch","renderUnreadCount","formatConversationFromEvent","conversation","recursivelyLowercaseKeys","object","Object","keys","reduce","carry","key","isArray","toLowerCase","formatted","messages","message","useridfrom","userfrom","id","conversations","userId","pending","formatMessagePreview","lastMessage","tmpElement","document","createElement","innerHTML","replace","isMedia","querySelector","messagePreview","indexOf","pix","label","includes","labelString","renderPix","icon","exception","mapPromises","length","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","Promise","all","formattedConversations","forEach","Date","toDateString","istoday","js","resolve","Deferred","error","getLoadCallback","types","includeFavourites","offset","includeSelfConversations","nonSelfConversationTypes","filter","candidate","getConversations","response","slice","setLoadedAll","getTotalConversationCountElement","getTotalUnreadConversationCountElement","incrementTotalConversationCount","element","parseInt","decrementTotalConversationCount","decrementTotalUnreadConversationCount","getConversationElement","conversationId","getConversationElementFromUserId","muteConversation","conversationElement","unmuteConversation","blockContact","unblockContact","createNewConversationFromEvent","existingConversations","listRoot","showContent","hideEmptyMessage","contentContainer","getContentContainer","prepend","deleteConversation","remove","hideContent","showEmptyMessage","markConversationAsRead","unreadCount","registerEventListeners","namespace","loadCallback","fromPanel","conversationBelongsToThisSection","conversationType","isFavourite","toggle","css","outerHeight","on","show","append","subscribe","CONTACT_BLOCKED","CONTACT_UNBLOCKED","CONVERSATION_SET_MUTED","CONVERSATION_UNSET_MUTED","CONVERSATION_NEW_LAST_MESSAGE","loggedInUserId","CONVERSATION_DELETED","CONVERSATION_READ","CONVERSATION_SET_FAVOURITE","CONVERSATION_UNSET_FAVOURITE","events","activate","e","data","target","closest","go","VIEW_CONVERSATION","originalEvent","preventDefault","header","body","footer","totalCountPromise","unreadCountPromise"],"mappings":"kYAsBAA,OAAM,qDACN,CACI,QADJ,CAEI,gCAFJ,CAGI,mBAHJ,CAII,aAJJ,CAKI,UALJ,CAMI,cANJ,CAOI,gBAPJ,CAQI,gBARJ,CASI,iCATJ,CAUI,oCAVJ,CAWI,oCAXJ,CAYI,oCAZJ,CAaI,4CAbJ,CAcI,yDAdJ,CADM,CAiBN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYIC,CAZJ,CAaIC,CAbJ,CAcIC,CAdJ,CAeE,IAEMC,CAAAA,CAAS,CAAG,CACZC,MAAM,CAAE,0BADI,CAEZC,YAAY,CAAE,wBAFF,CAGZC,sBAAsB,CAAE,wCAHZ,CAIZC,YAAY,CAAE,gCAJF,CAKZC,iBAAiB,CAAE,qCALP,CAMZC,oBAAoB,CAAE,wCANV,CAOZC,YAAY,CAAE,gCAPF,CAQZC,mBAAmB,CAAE,u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AA0CC,CAA1C,CAAkD,CACxF,MAAOxB,CAAAA,CAAM,CAACuB,CAAD,CAAgBC,CAAhB,CAAN,CACFvB,IADE,CACG,SAASC,CAAT,CAAe,CACjB+G,CAAgB,CAACqB,MAAjB,CAAwBpI,CAAxB,EACA,MAAOA,CAAAA,CACV,CAJE,EAKFE,KALE,CAKI1D,CAAY,CAACiG,SALjB,CAMV,CAPD,CAQH,CAIDoH,CAAiB,CAAC9J,IAAlB,CAAuB,SAASf,CAAT,CAAgB,CACnCD,CAAgB,CAACP,CAAD,CAAOQ,CAAP,CAAhB,CACAX,CAAiB,GAEpB,CAJD,EAKC6B,KALD,CAKO,UAAW,CAEjB,CAPD,EAWA4J,CAAkB,CAAC/J,IAAnB,CAAwB,SAASf,CAAT,CAAgB,CACpCmB,CAAiB,CAAC3B,CAAD,CAAOQ,CAAP,CAAjB,CACAV,CAAkB,GAErB,CAJD,EAKC4B,KALD,CAKO,UAAW,CAEjB,CAPD,EASA1B,CAAI,CAACgB,IAAL,CAAU,WAAV,IACH,CACJ,CAEM,CAEHjB,SAAS,CAAEA,CAFR,CAIV,CApxBK,CAAN","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 .\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 \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 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 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-label', 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 countElement = root.find(SELECTORS.SECTION_UNREAD_COUNT);\n countElement.text(count);\n\n Str.get_string('unreadconversations', 'core_message', count).done(function(string) {\n countElement.attr('aria-label', string);\n });\n\n if (count > 0) {\n countElement.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 {Object} contentContainer Conversations content container.\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 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 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 contentContainer.prepend(html);\n element.remove();\n return html;\n })\n .catch(Notification.exception);\n } else {\n createNewConversationFromEvent(root, conversation, loggedInUserId);\n }\n });\n\n PubSub.subscribe(MessageDrawerEvents.CONVERSATION_DELETED, function(conversationId) {\n var conversationElement = getConversationElement(root, conversationId);\n delete loadedConversationsById[conversationId];\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"],"file":"message_drawer_view_overview_section.min.js"} \ No newline at end of file diff --git a/message/amd/src/message_drawer_view_overview_section.js b/message/amd/src/message_drawer_view_overview_section.js index 8fa739828bf..fed38be8407 100644 --- a/message/amd/src/message_drawer_view_overview_section.js +++ b/message/amd/src/message_drawer_view_overview_section.js @@ -223,7 +223,10 @@ function( // If that's not possible, we'll report it under the catch-all 'other media'. var messagePreview = $(lastMessage.text).text(); if (messagePreview) { - return messagePreview; + // The text value of the message must have no html/script tags. + if (messagePreview.indexOf('<') == -1) { + return messagePreview; + } } }