/
var
/
www
/
html
/
lgpd
/
message
/
amd
/
build
/
Upload File
HOME
{"version":3,"sources":["../src/message_user_button.js"],"names":["define","$","CustomEvents","MessageDrawerHelper","getUserId","element","parseInt","attr","getConversationId","send","events","activate","on","e","data","conversationid","showConversation","createConversationWithUser","preventDefault","originalEvent"],"mappings":"AAsBAA,OAAM,oCAAC,CAAC,QAAD,CAAW,gCAAX,CAA6C,oCAA7C,CAAD,CACF,SAASC,CAAT,CAAYC,CAAZ,CAA0BC,CAA1B,CAA+C,IAQvCC,CAAAA,CAAS,CAAG,SAASC,CAAT,CAAkB,CAC9B,MAAOC,CAAAA,QAAQ,CAACD,CAAO,CAACE,IAAR,CAAa,aAAb,CAAD,CAClB,CAV0C,CAkBvCC,CAAiB,CAAG,SAASH,CAAT,CAAkB,CACtC,MAAOC,CAAAA,QAAQ,CAACD,CAAO,CAACE,IAAR,CAAa,qBAAb,CAAD,CAClB,CApB0C,CA8C3C,MAA6D,CACzDE,IAAI,CAlBG,QAAPA,CAAAA,IAAO,CAASJ,CAAT,CAAkB,CACzBA,CAAO,CAAGJ,CAAC,CAACI,CAAD,CAAX,CAEAH,CAAY,CAACF,MAAb,CAAoBK,CAApB,CAA6B,CAACH,CAAY,CAACQ,MAAb,CAAoBC,QAArB,CAA7B,EAEAN,CAAO,CAACO,EAAR,CAAWV,CAAY,CAACQ,MAAb,CAAoBC,QAA/B,CAAyC,SAASE,CAAT,CAAYC,CAAZ,CAAkB,CACvD,GAAIC,CAAAA,CAAc,CAAGP,CAAiB,CAACH,CAAD,CAAtC,CACA,GAAIU,CAAJ,CAAoB,CAChBZ,CAAmB,CAACa,gBAApB,CAAqCD,CAArC,CACH,CAFD,IAEO,CACHZ,CAAmB,CAACc,0BAApB,CAA+Cb,CAAS,CAACC,CAAD,CAAxD,CACH,CACDQ,CAAC,CAACK,cAAF,GACAJ,CAAI,CAACK,aAAL,CAAmBD,cAAnB,EACH,CATD,CAUH,CAE4D,CAGhE,CAlDC,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 <http://www.gnu.org/licenses/>.\n\n/**\n * Module to message a user from their profile page.\n *\n * @module core_message/message_user_button\n * @copyright 2019 Mark Nelson <markn@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/custom_interaction_events', 'core_message/message_drawer_helper'],\n function($, CustomEvents, MessageDrawerHelper) {\n\n /**\n * Get the id for the user being messaged.\n *\n * @param {object} element jQuery object for the button\n * @return {int}\n */\n var getUserId = function(element) {\n return parseInt(element.attr('data-userid'));\n };\n\n /**\n * Returns the conversation id, 0 if none.\n *\n * @param {object} element jQuery object for the button\n * @return {int}\n */\n var getConversationId = function(element) {\n return parseInt(element.attr('data-conversationid'));\n };\n\n /**\n * Handles opening the messaging drawer to send a\n * message to a given user.\n *\n * @method enhance\n * @param {object} element jQuery object for the button\n */\n var send = function(element) {\n element = $(element);\n\n CustomEvents.define(element, [CustomEvents.events.activate]);\n\n element.on(CustomEvents.events.activate, function(e, data) {\n var conversationid = getConversationId(element);\n if (conversationid) {\n MessageDrawerHelper.showConversation(conversationid);\n } else {\n MessageDrawerHelper.createConversationWithUser(getUserId(element));\n }\n e.preventDefault();\n data.originalEvent.preventDefault();\n });\n };\n\n return /** @alias module:core_message/message_user_button */ {\n send: send\n };\n });\n"],"file":"message_user_button.min.js"}