From 363aaf6eaa9d513ee642f4883c18e530ee016191 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Tue, 19 May 2020 11:14:20 +1000 Subject: [PATCH] MDL-68076 core: log user's click on feedback links --- lang/en/moodle.php | 2 + lib/amd/build/userfeedback.min.js | 2 +- lib/amd/build/userfeedback.min.js.map | 2 +- lib/amd/src/userfeedback.js | 1 + lib/classes/event/userfeedback_give.php | 63 +++++++++++++++++++ lib/classes/event/userfeedback_remind.php | 63 +++++++++++++++++++ .../external/userfeedback/record_action.php | 16 ++++- .../userfeedback/record_action_test.php | 6 ++ version.php | 2 +- 9 files changed, 152 insertions(+), 5 deletions(-) create mode 100644 lib/classes/event/userfeedback_give.php create mode 100644 lib/classes/event/userfeedback_remind.php diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 497fdb0cc3f..a5754a78da1 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -805,6 +805,8 @@ $string['eventsearchresultsviewed'] = 'Search results viewed'; $string['eventunknownlogged'] = 'Unknown event'; $string['eventusercreated'] = 'User created'; $string['eventuserdeleted'] = 'User deleted'; +$string['eventuserfeedbackgiven'] = 'Feedback link clicked'; +$string['eventuserfeedbackremind'] = 'Remind me later feedback link clicked'; $string['eventuserlistviewed'] = 'User list viewed'; $string['eventuserloggedout'] = 'User logged out'; $string['eventuserpasswordpolicyfailed'] = 'User password failed password policy'; diff --git a/lib/amd/build/userfeedback.min.js b/lib/amd/build/userfeedback.min.js index 5eb8d7c8df9..3eee54bf623 100644 --- a/lib/amd/build/userfeedback.min.js +++ b/lib/amd/build/userfeedback.min.js @@ -1,2 +1,2 @@ -define ("core/userfeedback",["exports","core/ajax","core/notification"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.registerEventListeners=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}var f={regions:{root:"[data-region=\"core/userfeedback\"]"},actions:{}};f.actions.give="".concat(f.regions.root," [data-action=\"give\"]");f.actions.remind="".concat(f.regions.root," [data-action=\"remind\"]");a.registerEventListeners=function registerEventListeners(){document.addEventListener("click",function(a){var b=a.target.closest(f.actions.give);if(b){a.preventDefault();g().then(function(){return i(b)}).then(h).catch(c.default.exception)}var d=a.target.closest(f.actions.remind);if(d){a.preventDefault();Promise.resolve(d).then(i).then(h).catch(c.default.exception)}})};var g=function(){return b.default.call([{methodname:"core_get_userfeedback_url",args:{contextid:M.cfg.contextid}}])[0].then(function(a){if(!window.open(a)){throw new Error("Unable to open popup")}})},h=function(a){if(a.dataset.record){return b.default.call([{methodname:"core_create_userfeedback_action_record",args:{action:a.dataset.action}}])[0]}return Promise.resolve()},i=function(a){if(a.dataset.hide){a.closest(f.regions.root).remove()}return a}}); +define ("core/userfeedback",["exports","core/ajax","core/notification"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.registerEventListeners=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}var f={regions:{root:"[data-region=\"core/userfeedback\"]"},actions:{}};f.actions.give="".concat(f.regions.root," [data-action=\"give\"]");f.actions.remind="".concat(f.regions.root," [data-action=\"remind\"]");a.registerEventListeners=function registerEventListeners(){document.addEventListener("click",function(a){var b=a.target.closest(f.actions.give);if(b){a.preventDefault();g().then(function(){return i(b)}).then(h).catch(c.default.exception)}var d=a.target.closest(f.actions.remind);if(d){a.preventDefault();Promise.resolve(d).then(i).then(h).catch(c.default.exception)}})};var g=function(){return b.default.call([{methodname:"core_get_userfeedback_url",args:{contextid:M.cfg.contextid}}])[0].then(function(a){if(!window.open(a)){throw new Error("Unable to open popup")}})},h=function(a){if(a.dataset.record){return b.default.call([{methodname:"core_create_userfeedback_action_record",args:{action:a.dataset.action,contextid:M.cfg.contextid}}])[0]}return Promise.resolve()},i=function(a){if(a.dataset.hide){a.closest(f.regions.root).remove()}return a}}); //# sourceMappingURL=userfeedback.min.js.map diff --git a/lib/amd/build/userfeedback.min.js.map b/lib/amd/build/userfeedback.min.js.map index 5f74d58a0fe..2a4225f3097 100644 --- a/lib/amd/build/userfeedback.min.js.map +++ b/lib/amd/build/userfeedback.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/userfeedback.js"],"names":["Selectors","regions","root","actions","give","remind","registerEventListeners","document","addEventListener","e","giveAction","target","closest","preventDefault","giveFeedback","then","hideRoot","recordAction","catch","Notification","exception","remindAction","Promise","resolve","Ajax","call","methodname","args","contextid","M","cfg","url","window","open","Error","clickedItem","dataset","record","action","hide","remove"],"mappings":"sLAuBA,OACA,O,mDAEA,GAAMA,CAAAA,CAAS,CAAG,CACdC,OAAO,CAAE,CACLC,IAAI,CAAE,qCADD,CADK,CAIdC,OAAO,CAAE,EAJK,CAAlB,CAMAH,CAAS,CAACG,OAAV,CAAkBC,IAAlB,WAA4BJ,CAAS,CAACC,OAAV,CAAkBC,IAA9C,4BACAF,CAAS,CAACG,OAAV,CAAkBE,MAAlB,WAA8BL,CAAS,CAACC,OAAV,CAAkBC,IAAhD,8B,yBAKsC,QAAzBI,CAAAA,sBAAyB,EAAM,CACxCC,QAAQ,CAACC,gBAAT,CAA0B,OAA1B,CAAmC,SAAAC,CAAC,CAAI,CACpC,GAAMC,CAAAA,CAAU,CAAGD,CAAC,CAACE,MAAF,CAASC,OAAT,CAAiBZ,CAAS,CAACG,OAAV,CAAkBC,IAAnC,CAAnB,CACA,GAAIM,CAAJ,CAAgB,CACZD,CAAC,CAACI,cAAF,GAEAC,CAAY,GACPC,IADL,CACU,iBAAMC,CAAAA,CAAQ,CAACN,CAAD,CAAd,CADV,EAEKK,IAFL,CAEUE,CAFV,EAGKC,KAHL,CAGWC,UAAaC,SAHxB,CAIH,CAED,GAAMC,CAAAA,CAAY,CAAGZ,CAAC,CAACE,MAAF,CAASC,OAAT,CAAiBZ,CAAS,CAACG,OAAV,CAAkBE,MAAnC,CAArB,CACA,GAAIgB,CAAJ,CAAkB,CACdZ,CAAC,CAACI,cAAF,GAEAS,OAAO,CAACC,OAAR,CAAgBF,CAAhB,EACKN,IADL,CACUC,CADV,EAEKD,IAFL,CAEUE,CAFV,EAGKC,KAHL,CAGWC,UAAaC,SAHxB,CAIH,CACJ,CApBD,CAqBH,C,IAOKN,CAAAA,CAAY,CAAG,UAAM,CACvB,MAAOU,WAAKC,IAAL,CAAU,CAAC,CACdC,UAAU,CAAE,2BADE,CAEdC,IAAI,CAAE,CACFC,SAAS,CAAEC,CAAC,CAACC,GAAF,CAAMF,SADf,CAFQ,CAAD,CAAV,EAKH,CALG,EAMFb,IANE,CAMG,SAAAgB,CAAG,CAAI,CACT,GAAI,CAACC,MAAM,CAACC,IAAP,CAAYF,CAAZ,CAAL,CAAuB,CACnB,KAAM,IAAIG,CAAAA,KAAJ,CAAU,sBAAV,CACT,CAEJ,CAXE,CAYV,C,CAQKjB,CAAY,CAAG,SAAAkB,CAAW,CAAI,CAChC,GAAIA,CAAW,CAACC,OAAZ,CAAoBC,MAAxB,CAAgC,CAC5B,MAAOb,WAAKC,IAAL,CAAU,CAAC,CACdC,UAAU,CAAE,wCADE,CAEdC,IAAI,CAAE,CACFW,MAAM,CAAEH,CAAW,CAACC,OAAZ,CAAoBE,MAD1B,CAFQ,CAAD,CAAV,EAKH,CALG,CAMV,CAED,MAAOhB,CAAAA,OAAO,CAACC,OAAR,EACV,C,CAQKP,CAAQ,CAAG,SAAAmB,CAAW,CAAI,CAC5B,GAAIA,CAAW,CAACC,OAAZ,CAAoBG,IAAxB,CAA8B,CAC1BJ,CAAW,CAACvB,OAAZ,CAAoBZ,CAAS,CAACC,OAAV,CAAkBC,IAAtC,EAA4CsC,MAA5C,EACH,CAED,MAAOL,CAAAA,CACV,C","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 * Handle clicking on action links of the feedback alert.\n *\n * @module core/cta_feedback\n * @copyright 2020 Shamim Rezaie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\n\nconst Selectors = {\n regions: {\n root: '[data-region=\"core/userfeedback\"]',\n },\n actions: {},\n};\nSelectors.actions.give = `${Selectors.regions.root} [data-action=\"give\"]`;\nSelectors.actions.remind = `${Selectors.regions.root} [data-action=\"remind\"]`;\n\n/**\n * Attach the necessary event handlers to the action links\n */\nexport const registerEventListeners = () => {\n document.addEventListener('click', e => {\n const giveAction = e.target.closest(Selectors.actions.give);\n if (giveAction) {\n e.preventDefault();\n\n giveFeedback()\n .then(() => hideRoot(giveAction))\n .then(recordAction)\n .catch(Notification.exception);\n }\n\n const remindAction = e.target.closest(Selectors.actions.remind);\n if (remindAction) {\n e.preventDefault();\n\n Promise.resolve(remindAction)\n .then(hideRoot)\n .then(recordAction)\n .catch(Notification.exception);\n }\n });\n};\n\n/**\n * The action function that is called when users choose to give feedback.\n *\n * @returns {Promise}\n */\nconst giveFeedback = () => {\n return Ajax.call([{\n methodname: 'core_get_userfeedback_url',\n args: {\n contextid: M.cfg.contextid,\n }\n }])[0]\n .then(url => {\n if (!window.open(url)) {\n throw new Error('Unable to open popup');\n }\n return;\n });\n};\n\n/**\n * Record the action that the user took.\n *\n * @param {HTMLElement} clickedItem The action element that the user chose.\n * @returns {Promise}\n */\nconst recordAction = clickedItem => {\n if (clickedItem.dataset.record) {\n return Ajax.call([{\n methodname: 'core_create_userfeedback_action_record',\n args: {\n action: clickedItem.dataset.action,\n }\n }])[0];\n }\n\n return Promise.resolve();\n};\n\n/**\n * Hide the root node of the CTA notification.\n *\n * @param {HTMLElement} clickedItem The action element that the user chose.\n * @returns {HTMLElement}\n */\nconst hideRoot = clickedItem => {\n if (clickedItem.dataset.hide) {\n clickedItem.closest(Selectors.regions.root).remove();\n }\n\n return clickedItem;\n};\n"],"file":"userfeedback.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/userfeedback.js"],"names":["Selectors","regions","root","actions","give","remind","registerEventListeners","document","addEventListener","e","giveAction","target","closest","preventDefault","giveFeedback","then","hideRoot","recordAction","catch","Notification","exception","remindAction","Promise","resolve","Ajax","call","methodname","args","contextid","M","cfg","url","window","open","Error","clickedItem","dataset","record","action","hide","remove"],"mappings":"sLAuBA,OACA,O,mDAEA,GAAMA,CAAAA,CAAS,CAAG,CACdC,OAAO,CAAE,CACLC,IAAI,CAAE,qCADD,CADK,CAIdC,OAAO,CAAE,EAJK,CAAlB,CAMAH,CAAS,CAACG,OAAV,CAAkBC,IAAlB,WAA4BJ,CAAS,CAACC,OAAV,CAAkBC,IAA9C,4BACAF,CAAS,CAACG,OAAV,CAAkBE,MAAlB,WAA8BL,CAAS,CAACC,OAAV,CAAkBC,IAAhD,8B,yBAKsC,QAAzBI,CAAAA,sBAAyB,EAAM,CACxCC,QAAQ,CAACC,gBAAT,CAA0B,OAA1B,CAAmC,SAAAC,CAAC,CAAI,CACpC,GAAMC,CAAAA,CAAU,CAAGD,CAAC,CAACE,MAAF,CAASC,OAAT,CAAiBZ,CAAS,CAACG,OAAV,CAAkBC,IAAnC,CAAnB,CACA,GAAIM,CAAJ,CAAgB,CACZD,CAAC,CAACI,cAAF,GAEAC,CAAY,GACPC,IADL,CACU,iBAAMC,CAAAA,CAAQ,CAACN,CAAD,CAAd,CADV,EAEKK,IAFL,CAEUE,CAFV,EAGKC,KAHL,CAGWC,UAAaC,SAHxB,CAIH,CAED,GAAMC,CAAAA,CAAY,CAAGZ,CAAC,CAACE,MAAF,CAASC,OAAT,CAAiBZ,CAAS,CAACG,OAAV,CAAkBE,MAAnC,CAArB,CACA,GAAIgB,CAAJ,CAAkB,CACdZ,CAAC,CAACI,cAAF,GAEAS,OAAO,CAACC,OAAR,CAAgBF,CAAhB,EACKN,IADL,CACUC,CADV,EAEKD,IAFL,CAEUE,CAFV,EAGKC,KAHL,CAGWC,UAAaC,SAHxB,CAIH,CACJ,CApBD,CAqBH,C,IAOKN,CAAAA,CAAY,CAAG,UAAM,CACvB,MAAOU,WAAKC,IAAL,CAAU,CAAC,CACdC,UAAU,CAAE,2BADE,CAEdC,IAAI,CAAE,CACFC,SAAS,CAAEC,CAAC,CAACC,GAAF,CAAMF,SADf,CAFQ,CAAD,CAAV,EAKH,CALG,EAMFb,IANE,CAMG,SAAAgB,CAAG,CAAI,CACT,GAAI,CAACC,MAAM,CAACC,IAAP,CAAYF,CAAZ,CAAL,CAAuB,CACnB,KAAM,IAAIG,CAAAA,KAAJ,CAAU,sBAAV,CACT,CAEJ,CAXE,CAYV,C,CAQKjB,CAAY,CAAG,SAAAkB,CAAW,CAAI,CAChC,GAAIA,CAAW,CAACC,OAAZ,CAAoBC,MAAxB,CAAgC,CAC5B,MAAOb,WAAKC,IAAL,CAAU,CAAC,CACdC,UAAU,CAAE,wCADE,CAEdC,IAAI,CAAE,CACFW,MAAM,CAAEH,CAAW,CAACC,OAAZ,CAAoBE,MAD1B,CAEFV,SAAS,CAAEC,CAAC,CAACC,GAAF,CAAMF,SAFf,CAFQ,CAAD,CAAV,EAMH,CANG,CAOV,CAED,MAAON,CAAAA,OAAO,CAACC,OAAR,EACV,C,CAQKP,CAAQ,CAAG,SAAAmB,CAAW,CAAI,CAC5B,GAAIA,CAAW,CAACC,OAAZ,CAAoBG,IAAxB,CAA8B,CAC1BJ,CAAW,CAACvB,OAAZ,CAAoBZ,CAAS,CAACC,OAAV,CAAkBC,IAAtC,EAA4CsC,MAA5C,EACH,CAED,MAAOL,CAAAA,CACV,C","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 * Handle clicking on action links of the feedback alert.\n *\n * @module core/cta_feedback\n * @copyright 2020 Shamim Rezaie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\n\nconst Selectors = {\n regions: {\n root: '[data-region=\"core/userfeedback\"]',\n },\n actions: {},\n};\nSelectors.actions.give = `${Selectors.regions.root} [data-action=\"give\"]`;\nSelectors.actions.remind = `${Selectors.regions.root} [data-action=\"remind\"]`;\n\n/**\n * Attach the necessary event handlers to the action links\n */\nexport const registerEventListeners = () => {\n document.addEventListener('click', e => {\n const giveAction = e.target.closest(Selectors.actions.give);\n if (giveAction) {\n e.preventDefault();\n\n giveFeedback()\n .then(() => hideRoot(giveAction))\n .then(recordAction)\n .catch(Notification.exception);\n }\n\n const remindAction = e.target.closest(Selectors.actions.remind);\n if (remindAction) {\n e.preventDefault();\n\n Promise.resolve(remindAction)\n .then(hideRoot)\n .then(recordAction)\n .catch(Notification.exception);\n }\n });\n};\n\n/**\n * The action function that is called when users choose to give feedback.\n *\n * @returns {Promise}\n */\nconst giveFeedback = () => {\n return Ajax.call([{\n methodname: 'core_get_userfeedback_url',\n args: {\n contextid: M.cfg.contextid,\n }\n }])[0]\n .then(url => {\n if (!window.open(url)) {\n throw new Error('Unable to open popup');\n }\n return;\n });\n};\n\n/**\n * Record the action that the user took.\n *\n * @param {HTMLElement} clickedItem The action element that the user chose.\n * @returns {Promise}\n */\nconst recordAction = clickedItem => {\n if (clickedItem.dataset.record) {\n return Ajax.call([{\n methodname: 'core_create_userfeedback_action_record',\n args: {\n action: clickedItem.dataset.action,\n contextid: M.cfg.contextid,\n }\n }])[0];\n }\n\n return Promise.resolve();\n};\n\n/**\n * Hide the root node of the CTA notification.\n *\n * @param {HTMLElement} clickedItem The action element that the user chose.\n * @returns {HTMLElement}\n */\nconst hideRoot = clickedItem => {\n if (clickedItem.dataset.hide) {\n clickedItem.closest(Selectors.regions.root).remove();\n }\n\n return clickedItem;\n};\n"],"file":"userfeedback.min.js"} \ No newline at end of file diff --git a/lib/amd/src/userfeedback.js b/lib/amd/src/userfeedback.js index a74bf4eb172..c1b1a7f56e4 100644 --- a/lib/amd/src/userfeedback.js +++ b/lib/amd/src/userfeedback.js @@ -92,6 +92,7 @@ const recordAction = clickedItem => { methodname: 'core_create_userfeedback_action_record', args: { action: clickedItem.dataset.action, + contextid: M.cfg.contextid, } }])[0]; } diff --git a/lib/classes/event/userfeedback_give.php b/lib/classes/event/userfeedback_give.php new file mode 100644 index 00000000000..e0b89dfbaca --- /dev/null +++ b/lib/classes/event/userfeedback_give.php @@ -0,0 +1,63 @@ +. + +/** + * Feedback given. + * + * @package core + * @copyright 2020 Shamim Rezaie + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace core\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Class userfeedback_give + * + * @package core + * @copyright 2020 Shamim Rezaie + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class userfeedback_give extends base { + + /** + * Initialise required event data properties. + */ + protected function init() { + $this->data['crud'] = 'r'; + $this->data['edulevel'] = self::LEVEL_OTHER; + } + + /** + * Returns description of what happened. + * + * @return string + */ + public function get_description() { + return "The user with id '$this->userid' clicked on the give feedback link"; + } + + /** + * Return localised event name. + * + * @return string + */ + public static function get_name() { + return get_string('eventuserfeedbackgiven'); + } + +} diff --git a/lib/classes/event/userfeedback_remind.php b/lib/classes/event/userfeedback_remind.php new file mode 100644 index 00000000000..e30205cb446 --- /dev/null +++ b/lib/classes/event/userfeedback_remind.php @@ -0,0 +1,63 @@ +. + +/** + * Feedback remind. + * + * @package core + * @copyright 2020 Shamim Rezaie + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace core\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Class userfeedback_remind + * + * @package core + * @copyright 2020 Shamim Rezaie + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class userfeedback_remind extends base { + + /** + * Initialise required event data properties. + */ + protected function init() { + $this->data['crud'] = 'r'; + $this->data['edulevel'] = self::LEVEL_OTHER; + } + + /** + * Returns description of what happened. + * + * @return string + */ + public function get_description() { + return "The user with id '$this->userid' clicked on the remind later to feedback link"; + } + + /** + * Return localised event name. + * + * @return string + */ + public static function get_name() { + return get_string('eventuserfeedbackremind'); + } + +} diff --git a/lib/classes/external/userfeedback/record_action.php b/lib/classes/external/userfeedback/record_action.php index 26f79fed5e9..e8950f5951a 100644 --- a/lib/classes/external/userfeedback/record_action.php +++ b/lib/classes/external/userfeedback/record_action.php @@ -47,6 +47,7 @@ class record_action extends external_api { public static function execute_parameters() { return new external_function_parameters([ 'action' => new external_value(PARAM_ALPHA, 'The action taken by user'), + 'contextid' => new external_value(PARAM_INT, 'The context id of the page the user is in'), ]); } @@ -54,17 +55,28 @@ class record_action extends external_api { * Record users action to the feedback CTA * * @param string $action The action the user took + * @param int $contextid The context id * @throws \invalid_parameter_exception */ - public static function execute(string $action) { - external_api::validate_parameters(self::execute_parameters(), ['action' => $action]); + public static function execute(string $action, int $contextid) { + external_api::validate_parameters(self::execute_parameters(), [ + 'action' => $action, + 'contextid' => $contextid, + ]); + + $context = \context::instance_by_id($contextid); + self::validate_context($context); switch ($action) { case 'give': set_user_preference('core_userfeedback_give', time()); + $event = \core\event\userfeedback_give::create(['context' => $context]); + $event->trigger(); break; case 'remind': set_user_preference('core_userfeedback_remind', time()); + $event = \core\event\userfeedback_remind::create(['context' => $context]); + $event->trigger(); break; default: throw new \invalid_parameter_exception('Invalid value for action parameter (value: ' . $action . '),' . diff --git a/lib/tests/external/userfeedback/record_action_test.php b/lib/tests/external/userfeedback/record_action_test.php index 610acad35bd..f67cf57b6d9 100644 --- a/lib/tests/external/userfeedback/record_action_test.php +++ b/lib/tests/external/userfeedback/record_action_test.php @@ -69,6 +69,7 @@ class record_action_testcase extends externallib_advanced_testcase { $context = context_system::instance(); $user = $this->getDataGenerator()->create_user(); $this->setUser($user); + $eventsink = $this->redirectEvents(); $now = time(); @@ -78,5 +79,10 @@ class record_action_testcase extends externallib_advanced_testcase { $preference = get_user_preferences('core_userfeedback_' . $action); $this->assertGreaterThanOrEqual($now, $preference); + + $events = $eventsink->get_events(); + $this->assertCount(1, $events); + $this->assertInstanceOf('\core\event\userfeedback_' . $action, $events[0]); + $eventsink->clear(); } } diff --git a/version.php b/version.php index 9dec8821b66..e89cfb9fa9d 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2020052900.02; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2020052900.03; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '3.9dev+ (Build: 20200529)'; // Human-friendly version name