From fca2456e1fe24b7fdc1b983c8348c00e4959914d Mon Sep 17 00:00:00 2001 From: Yannick Schillinger Date: Tue, 4 Apr 2023 12:53:44 +0200 Subject: [PATCH 1/2] MDL-77816 mod_bigbluebuttonbn: Fix completionValidate argument format --- mod/bigbluebuttonbn/amd/build/repository.min.js | 2 +- mod/bigbluebuttonbn/amd/build/repository.min.js.map | 2 +- mod/bigbluebuttonbn/amd/src/repository.js | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mod/bigbluebuttonbn/amd/build/repository.min.js b/mod/bigbluebuttonbn/amd/build/repository.min.js index 5c8de678040..9668c07bc7c 100644 --- a/mod/bigbluebuttonbn/amd/build/repository.min.js +++ b/mod/bigbluebuttonbn/amd/build/repository.min.js @@ -1,3 +1,3 @@ -define("mod_bigbluebuttonbn/repository",["exports","core/ajax"],(function(_exports,_ajax){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.updateRecording=_exports.getMeetingInfo=_exports.fetchRecordingsToImport=_exports.fetchRecordings=_exports.endMeeting=_exports.completionValidate=void 0;_exports.fetchRecordings=(bigbluebuttonbnid,tools,groupid)=>{const args={bigbluebuttonbnid:bigbluebuttonbnid,tools:tools};return groupid&&(args.groupid=groupid),(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_get_recordings",args:args}])[0]};_exports.fetchRecordingsToImport=(destinationinstanceid,sourcebigbluebuttonbnid,sourcecourseid,tools,groupid)=>{const args={destinationinstanceid:destinationinstanceid,sourcebigbluebuttonbnid:sourcebigbluebuttonbnid,sourcecourseid:sourcecourseid,tools:tools};return groupid&&(args.groupid=groupid),(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_get_recordings_to_import",args:args}])[0]};_exports.updateRecording=args=>(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_update_recording",args:args}])[0];_exports.endMeeting=(bigbluebuttonbnid,groupid)=>(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_end_meeting",args:{bigbluebuttonbnid:bigbluebuttonbnid,groupid:groupid}}])[0];_exports.completionValidate=args=>(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_completion_validate",args:args}])[0];_exports.getMeetingInfo=function(bigbluebuttonbnid,groupid){let updatecache=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_meeting_info",args:{bigbluebuttonbnid:bigbluebuttonbnid,groupid:groupid,updatecache:updatecache}}])[0]}})); +define("mod_bigbluebuttonbn/repository",["exports","core/ajax"],(function(_exports,_ajax){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.updateRecording=_exports.getMeetingInfo=_exports.fetchRecordingsToImport=_exports.fetchRecordings=_exports.endMeeting=_exports.completionValidate=void 0;_exports.fetchRecordings=(bigbluebuttonbnid,tools,groupid)=>{const args={bigbluebuttonbnid:bigbluebuttonbnid,tools:tools};return groupid&&(args.groupid=groupid),(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_get_recordings",args:args}])[0]};_exports.fetchRecordingsToImport=(destinationinstanceid,sourcebigbluebuttonbnid,sourcecourseid,tools,groupid)=>{const args={destinationinstanceid:destinationinstanceid,sourcebigbluebuttonbnid:sourcebigbluebuttonbnid,sourcecourseid:sourcecourseid,tools:tools};return groupid&&(args.groupid=groupid),(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_get_recordings_to_import",args:args}])[0]};_exports.updateRecording=args=>(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_update_recording",args:args}])[0];_exports.endMeeting=(bigbluebuttonbnid,groupid)=>(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_end_meeting",args:{bigbluebuttonbnid:bigbluebuttonbnid,groupid:groupid}}])[0];_exports.completionValidate=bigbluebuttonbnid=>(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_completion_validate",args:{bigbluebuttonbnid:bigbluebuttonbnid}}])[0];_exports.getMeetingInfo=function(bigbluebuttonbnid,groupid){let updatecache=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,_ajax.call)([{methodname:"mod_bigbluebuttonbn_meeting_info",args:{bigbluebuttonbnid:bigbluebuttonbnid,groupid:groupid,updatecache:updatecache}}])[0]}})); //# sourceMappingURL=repository.min.js.map \ No newline at end of file diff --git a/mod/bigbluebuttonbn/amd/build/repository.min.js.map b/mod/bigbluebuttonbn/amd/build/repository.min.js.map index 6871544867f..c35a5e9ffc4 100644 --- a/mod/bigbluebuttonbn/amd/build/repository.min.js.map +++ b/mod/bigbluebuttonbn/amd/build/repository.min.js.map @@ -1 +1 @@ -{"version":3,"file":"repository.min.js","sources":["../src/repository.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 .\n\n/**\n * Repository to perform WS calls for mod_bigbluebuttonbn.\n *\n * @module mod_bigbluebuttonbn/repository\n * @copyright 2021 Blindside Networks Inc\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\n\n/**\n * Fetch the list of recordings from the server.\n *\n * @param {Number} bigbluebuttonbnid The instance ID\n * @param {String} tools the set of tools to display\n * @param {number} groupid\n * @returns {Promise}\n */\nexport const fetchRecordings = (bigbluebuttonbnid, tools, groupid) => {\n const args = {\n bigbluebuttonbnid,\n tools,\n };\n\n if (groupid) {\n args.groupid = groupid;\n }\n\n return fetchMany([{methodname: 'mod_bigbluebuttonbn_get_recordings', args}])[0];\n};\n\n/**\n * Fetch the list of recordings from the server that can be imported.\n *\n * @param {Number} destinationinstanceid The destination instance ID\n * @param {Number} sourcebigbluebuttonbnid The original instance ID\n * @param {Number} sourcecourseid The destination instance ID\n * @param {String} tools the set of tools to display\n * @param {number} groupid\n * @returns {Promise}\n */\nexport const fetchRecordingsToImport = (\n destinationinstanceid,\n sourcebigbluebuttonbnid,\n sourcecourseid,\n tools,\n groupid\n) => {\n const args = {\n destinationinstanceid,\n sourcebigbluebuttonbnid,\n sourcecourseid,\n tools,\n };\n\n if (groupid) {\n args.groupid = groupid;\n }\n\n return fetchMany([{methodname: 'mod_bigbluebuttonbn_get_recordings_to_import', args}])[0];\n};\n\n/**\n * Perform an update on a single recording.\n *\n * @param {object} args The instance ID\n * @returns {Promise}\n */\nexport const updateRecording = args => fetchMany([\n {\n methodname: 'mod_bigbluebuttonbn_update_recording',\n args,\n }\n])[0];\n\n/**\n * End the Meeting\n *\n * @param {number} bigbluebuttonbnid\n * @param {number} groupid\n * @returns {Promise}\n */\nexport const endMeeting = (bigbluebuttonbnid, groupid) => fetchMany([\n {\n methodname: 'mod_bigbluebuttonbn_end_meeting',\n args: {\n bigbluebuttonbnid,\n groupid\n },\n }\n])[0];\n\n/**\n * Validate completion.\n *\n * @param {object} args\n * @returns {Promise}\n */\nexport const completionValidate = args => fetchMany([\n {\n methodname: 'mod_bigbluebuttonbn_completion_validate',\n args,\n }\n])[0];\n\n\n/**\n * Fetch meeting info for the specified meeting.\n *\n * @param {number} bigbluebuttonbnid\n * @param {number} groupid\n * @param {boolean} [updatecache=false]\n * @returns {Promise}\n */\nexport const getMeetingInfo = (bigbluebuttonbnid, groupid, updatecache = false) => fetchMany([\n {\n methodname: 'mod_bigbluebuttonbn_meeting_info',\n args: {\n bigbluebuttonbnid,\n groupid,\n updatecache,\n },\n }\n])[0];\n"],"names":["bigbluebuttonbnid","tools","groupid","args","methodname","destinationinstanceid","sourcebigbluebuttonbnid","sourcecourseid","updatecache"],"mappings":"6UAiC+B,CAACA,kBAAmBC,MAAOC,iBAChDC,KAAO,CACTH,kBAAAA,kBACAC,MAAAA,cAGAC,UACAC,KAAKD,QAAUA,UAGZ,cAAU,CAAC,CAACE,WAAY,qCAAsCD,KAAAA,QAAQ,qCAa1C,CACnCE,sBACAC,wBACAC,eACAN,MACAC,iBAEMC,KAAO,CACTE,sBAAAA,sBACAC,wBAAAA,wBACAC,eAAAA,eACAN,MAAAA,cAGAC,UACAC,KAAKD,QAAUA,UAGZ,cAAU,CAAC,CAACE,WAAY,+CAAgDD,KAAAA,QAAQ,6BAS5DA,OAAQ,cAAU,CAC7C,CACIC,WAAY,uCACZD,KAAAA,QAEL,uBASuB,CAACH,kBAAmBE,WAAY,cAAU,CAChE,CACIE,WAAY,kCACZD,KAAM,CACFH,kBAAAA,kBACAE,QAAAA,YAGT,+BAQ+BC,OAAQ,cAAU,CAChD,CACIC,WAAY,0CACZD,KAAAA,QAEL,2BAW2B,SAACH,kBAAmBE,aAASM,2EAAwB,cAAU,CACzF,CACIJ,WAAY,mCACZD,KAAM,CACFH,kBAAAA,kBACAE,QAAAA,QACAM,YAAAA,gBAGT"} \ No newline at end of file +{"version":3,"file":"repository.min.js","sources":["../src/repository.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 .\n\n/**\n * Repository to perform WS calls for mod_bigbluebuttonbn.\n *\n * @module mod_bigbluebuttonbn/repository\n * @copyright 2021 Blindside Networks Inc\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\n\n/**\n * Fetch the list of recordings from the server.\n *\n * @param {Number} bigbluebuttonbnid The instance ID\n * @param {String} tools the set of tools to display\n * @param {number} groupid\n * @returns {Promise}\n */\nexport const fetchRecordings = (bigbluebuttonbnid, tools, groupid) => {\n const args = {\n bigbluebuttonbnid,\n tools,\n };\n\n if (groupid) {\n args.groupid = groupid;\n }\n\n return fetchMany([{methodname: 'mod_bigbluebuttonbn_get_recordings', args}])[0];\n};\n\n/**\n * Fetch the list of recordings from the server that can be imported.\n *\n * @param {Number} destinationinstanceid The destination instance ID\n * @param {Number} sourcebigbluebuttonbnid The original instance ID\n * @param {Number} sourcecourseid The destination instance ID\n * @param {String} tools the set of tools to display\n * @param {number} groupid\n * @returns {Promise}\n */\nexport const fetchRecordingsToImport = (\n destinationinstanceid,\n sourcebigbluebuttonbnid,\n sourcecourseid,\n tools,\n groupid\n) => {\n const args = {\n destinationinstanceid,\n sourcebigbluebuttonbnid,\n sourcecourseid,\n tools,\n };\n\n if (groupid) {\n args.groupid = groupid;\n }\n\n return fetchMany([{methodname: 'mod_bigbluebuttonbn_get_recordings_to_import', args}])[0];\n};\n\n/**\n * Perform an update on a single recording.\n *\n * @param {object} args The instance ID\n * @returns {Promise}\n */\nexport const updateRecording = args => fetchMany([\n {\n methodname: 'mod_bigbluebuttonbn_update_recording',\n args,\n }\n])[0];\n\n/**\n * End the Meeting\n *\n * @param {number} bigbluebuttonbnid\n * @param {number} groupid\n * @returns {Promise}\n */\nexport const endMeeting = (bigbluebuttonbnid, groupid) => fetchMany([\n {\n methodname: 'mod_bigbluebuttonbn_end_meeting',\n args: {\n bigbluebuttonbnid,\n groupid\n },\n }\n])[0];\n\n/**\n * Validate completion.\n *\n * @param {number} bigbluebuttonbnid\n * @returns {Promise}\n */\nexport const completionValidate = (bigbluebuttonbnid) => fetchMany([\n {\n methodname: 'mod_bigbluebuttonbn_completion_validate',\n args: {\n bigbluebuttonbnid\n },\n }\n])[0];\n\n\n/**\n * Fetch meeting info for the specified meeting.\n *\n * @param {number} bigbluebuttonbnid\n * @param {number} groupid\n * @param {boolean} [updatecache=false]\n * @returns {Promise}\n */\nexport const getMeetingInfo = (bigbluebuttonbnid, groupid, updatecache = false) => fetchMany([\n {\n methodname: 'mod_bigbluebuttonbn_meeting_info',\n args: {\n bigbluebuttonbnid,\n groupid,\n updatecache,\n },\n }\n])[0];\n"],"names":["bigbluebuttonbnid","tools","groupid","args","methodname","destinationinstanceid","sourcebigbluebuttonbnid","sourcecourseid","updatecache"],"mappings":"6UAiC+B,CAACA,kBAAmBC,MAAOC,iBAChDC,KAAO,CACTH,kBAAAA,kBACAC,MAAAA,cAGAC,UACAC,KAAKD,QAAUA,UAGZ,cAAU,CAAC,CAACE,WAAY,qCAAsCD,KAAAA,QAAQ,qCAa1C,CACnCE,sBACAC,wBACAC,eACAN,MACAC,iBAEMC,KAAO,CACTE,sBAAAA,sBACAC,wBAAAA,wBACAC,eAAAA,eACAN,MAAAA,cAGAC,UACAC,KAAKD,QAAUA,UAGZ,cAAU,CAAC,CAACE,WAAY,+CAAgDD,KAAAA,QAAQ,6BAS5DA,OAAQ,cAAU,CAC7C,CACIC,WAAY,uCACZD,KAAAA,QAEL,uBASuB,CAACH,kBAAmBE,WAAY,cAAU,CAChE,CACIE,WAAY,kCACZD,KAAM,CACFH,kBAAAA,kBACAE,QAAAA,YAGT,+BAQgCF,oBAAsB,cAAU,CAC/D,CACII,WAAY,0CACZD,KAAM,CACFH,kBAAAA,sBAGT,2BAW2B,SAACA,kBAAmBE,aAASM,2EAAwB,cAAU,CACzF,CACIJ,WAAY,mCACZD,KAAM,CACFH,kBAAAA,kBACAE,QAAAA,QACAM,YAAAA,gBAGT"} \ No newline at end of file diff --git a/mod/bigbluebuttonbn/amd/src/repository.js b/mod/bigbluebuttonbn/amd/src/repository.js index 9906f433c29..6885084503d 100644 --- a/mod/bigbluebuttonbn/amd/src/repository.js +++ b/mod/bigbluebuttonbn/amd/src/repository.js @@ -108,13 +108,15 @@ export const endMeeting = (bigbluebuttonbnid, groupid) => fetchMany([ /** * Validate completion. * - * @param {object} args + * @param {number} bigbluebuttonbnid * @returns {Promise} */ -export const completionValidate = args => fetchMany([ +export const completionValidate = (bigbluebuttonbnid) => fetchMany([ { methodname: 'mod_bigbluebuttonbn_completion_validate', - args, + args: { + bigbluebuttonbnid + }, } ])[0]; From 52ada82da207b2b2c827e8855d0590d3c583d31a Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 4 Oct 2023 20:07:35 +0100 Subject: [PATCH 2/2] MDL-77816 mod_bigbluebuttonbn: feedback when validating completion. --- mod/bigbluebuttonbn/amd/build/rooms.min.js | 4 ++-- mod/bigbluebuttonbn/amd/build/rooms.min.js.map | 2 +- mod/bigbluebuttonbn/amd/src/rooms.js | 16 +++++++++++++--- .../tests/behat/completion.feature | 18 +++++++++++++----- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/mod/bigbluebuttonbn/amd/build/rooms.min.js b/mod/bigbluebuttonbn/amd/build/rooms.min.js index c579824e0b4..136c253234f 100644 --- a/mod/bigbluebuttonbn/amd/build/rooms.min.js +++ b/mod/bigbluebuttonbn/amd/build/rooms.min.js @@ -1,10 +1,10 @@ -define("mod_bigbluebuttonbn/rooms",["exports","./actions","./repository","./roomupdater","core/notification","./events"],(function(_exports,_actions,repository,roomUpdater,_notification,_events){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj} +define("mod_bigbluebuttonbn/rooms",["exports","./actions","./repository","./roomupdater","core/notification","core/pending","core/str","core/toast","./events"],(function(_exports,_actions,repository,roomUpdater,_notification,_pending,_str,_toast,_events){var obj;function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj} /** * JS actions for the rooms page for mod_bigbluebuttonbn. * * @module mod_bigbluebuttonbn/rooms * @copyright 2021 Blindside Networks Inc * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.setupWindowAutoClose=_exports.init=void 0,repository=_interopRequireWildcard(repository),roomUpdater=_interopRequireWildcard(roomUpdater);_exports.init=(bigbluebuttonbnid,pollInterval)=>{const completionElement=document.querySelector("a[href*=completion_validate]");completionElement&&completionElement.addEventListener("click",(()=>{repository.completionValidate(bigbluebuttonbnid).catch(_notification.exception)})),document.addEventListener("click",(e=>{const joinButton=e.target.closest('[data-action="join"]');joinButton&&(window.open(joinButton.href,"bigbluebutton_conference"),e.preventDefault(),setTimeout((()=>{roomUpdater.updateRoom(!0)}),pollInterval))})),document.addEventListener(_events.eventTypes.sessionEnded,(()=>{roomUpdater.stop(),roomUpdater.updateRoom(),(0,_notification.fetchNotifications)()})),window.addEventListener(_events.eventTypes.currentSessionEnded,(()=>{roomUpdater.stop(),roomUpdater.updateRoom(),(0,_notification.fetchNotifications)()})),roomUpdater.start(pollInterval)};_exports.setupWindowAutoClose=function(){let closeDelay=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;(0,_events.notifyCurrentSessionEnded)(window.opener),window.addEventListener("onbeforeunload",(()=>{window.opener.setTimeout((()=>{roomUpdater.updateRoom(!0)}),closeDelay)}),{once:!0}),window.close()}})); + */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.setupWindowAutoClose=_exports.init=void 0,repository=_interopRequireWildcard(repository),roomUpdater=_interopRequireWildcard(roomUpdater),_pending=(obj=_pending)&&obj.__esModule?obj:{default:obj};_exports.init=(bigbluebuttonbnid,pollInterval)=>{const completionElement=document.querySelector("a[href*=completion_validate]");completionElement&&completionElement.addEventListener("click",(event=>{event.preventDefault();const pendingPromise=new _pending.default("mod_bigbluebuttonbn/completion:validate");repository.completionValidate(bigbluebuttonbnid).then((()=>(0,_str.get_string)("completionvalidatestatetriggered","mod_bigbluebuttonbn"))).then((str=>(0,_toast.add)(str))).then((()=>pendingPromise.resolve())).catch(_notification.exception)})),document.addEventListener("click",(e=>{const joinButton=e.target.closest('[data-action="join"]');joinButton&&(window.open(joinButton.href,"bigbluebutton_conference"),e.preventDefault(),setTimeout((()=>{roomUpdater.updateRoom(!0)}),pollInterval))})),document.addEventListener(_events.eventTypes.sessionEnded,(()=>{roomUpdater.stop(),roomUpdater.updateRoom(),(0,_notification.fetchNotifications)()})),window.addEventListener(_events.eventTypes.currentSessionEnded,(()=>{roomUpdater.stop(),roomUpdater.updateRoom(),(0,_notification.fetchNotifications)()})),roomUpdater.start(pollInterval)};_exports.setupWindowAutoClose=function(){let closeDelay=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;(0,_events.notifyCurrentSessionEnded)(window.opener),window.addEventListener("onbeforeunload",(()=>{window.opener.setTimeout((()=>{roomUpdater.updateRoom(!0)}),closeDelay)}),{once:!0}),window.close()}})); //# sourceMappingURL=rooms.min.js.map \ No newline at end of file diff --git a/mod/bigbluebuttonbn/amd/build/rooms.min.js.map b/mod/bigbluebuttonbn/amd/build/rooms.min.js.map index 313dbe95918..67c174f8b8b 100644 --- a/mod/bigbluebuttonbn/amd/build/rooms.min.js.map +++ b/mod/bigbluebuttonbn/amd/build/rooms.min.js.map @@ -1 +1 @@ -{"version":3,"file":"rooms.min.js","sources":["../src/rooms.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 .\n\n/**\n * JS actions for the rooms page for mod_bigbluebuttonbn.\n *\n * @module mod_bigbluebuttonbn/rooms\n * @copyright 2021 Blindside Networks Inc\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport './actions';\nimport * as repository from './repository';\nimport * as roomUpdater from './roomupdater';\nimport {\n exception as displayException,\n fetchNotifications,\n} from 'core/notification';\n\nimport {eventTypes, notifyCurrentSessionEnded} from './events';\n\n/**\n * Init the room\n *\n * @param {Number} bigbluebuttonbnid bigblubeutton identifier\n * @param {Number} pollInterval poll interval in miliseconds\n */\nexport const init = (bigbluebuttonbnid, pollInterval) => {\n const completionElement = document.querySelector('a[href*=completion_validate]');\n if (completionElement) {\n completionElement.addEventListener(\"click\", () => {\n repository.completionValidate(bigbluebuttonbnid).catch(displayException);\n });\n }\n\n document.addEventListener('click', e => {\n const joinButton = e.target.closest('[data-action=\"join\"]');\n if (joinButton) {\n window.open(joinButton.href, 'bigbluebutton_conference');\n e.preventDefault();\n // Gives the user a bit of time to go into the meeting before polling the room.\n setTimeout(() => {\n roomUpdater.updateRoom(true);\n }, pollInterval);\n }\n });\n\n document.addEventListener(eventTypes.sessionEnded, () => {\n roomUpdater.stop();\n roomUpdater.updateRoom();\n fetchNotifications();\n });\n\n window.addEventListener(eventTypes.currentSessionEnded, () => {\n roomUpdater.stop();\n roomUpdater.updateRoom();\n fetchNotifications();\n });\n // Room update.\n roomUpdater.start(pollInterval);\n};\n\n/**\n * Auto close child windows when clicking the End meeting button.\n * @param {Number} closeDelay time to wait in miliseconds before closing the window\n */\nexport const setupWindowAutoClose = (closeDelay = 2000) => {\n notifyCurrentSessionEnded(window.opener);\n window.addEventListener('onbeforeunload', () => {\n window.opener.setTimeout(() => {\n roomUpdater.updateRoom(true);\n }, closeDelay);\n },\n {\n once: true\n });\n window.close(); // This does not work as scripts can only close windows that are opened by themselves.\n};\n"],"names":["bigbluebuttonbnid","pollInterval","completionElement","document","querySelector","addEventListener","repository","completionValidate","catch","displayException","e","joinButton","target","closest","window","open","href","preventDefault","setTimeout","roomUpdater","updateRoom","eventTypes","sessionEnded","stop","currentSessionEnded","start","closeDelay","opener","once","close"],"mappings":";;;;;;;8NAuCoB,CAACA,kBAAmBC,sBAC9BC,kBAAoBC,SAASC,cAAc,gCAC7CF,mBACAA,kBAAkBG,iBAAiB,SAAS,KACxCC,WAAWC,mBAAmBP,mBAAmBQ,MAAMC,4BAI/DN,SAASE,iBAAiB,SAASK,UACzBC,WAAaD,EAAEE,OAAOC,QAAQ,wBAChCF,aACAG,OAAOC,KAAKJ,WAAWK,KAAM,4BAC7BN,EAAEO,iBAEFC,YAAW,KACPC,YAAYC,YAAW,KACxBnB,kBAIXE,SAASE,iBAAiBgB,mBAAWC,cAAc,KAC/CH,YAAYI,OACZJ,YAAYC,uDAIhBN,OAAOT,iBAAiBgB,mBAAWG,qBAAqB,KACpDL,YAAYI,OACZJ,YAAYC,uDAIhBD,YAAYM,MAAMxB,6CAOc,eAACyB,kEAAa,0CACpBZ,OAAOa,QACjCb,OAAOT,iBAAiB,kBAAkB,KAClCS,OAAOa,OAAOT,YAAW,KACrBC,YAAYC,YAAW,KACxBM,cAEP,CACIE,MAAM,IAEdd,OAAOe"} \ No newline at end of file +{"version":3,"file":"rooms.min.js","sources":["../src/rooms.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 .\n\n/**\n * JS actions for the rooms page for mod_bigbluebuttonbn.\n *\n * @module mod_bigbluebuttonbn/rooms\n * @copyright 2021 Blindside Networks Inc\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport './actions';\nimport * as repository from './repository';\nimport * as roomUpdater from './roomupdater';\nimport {\n exception as displayException,\n fetchNotifications,\n} from 'core/notification';\nimport Pending from 'core/pending';\nimport {get_string as getString} from 'core/str';\nimport {add as addToast} from 'core/toast';\nimport {eventTypes, notifyCurrentSessionEnded} from './events';\n\n/**\n * Init the room\n *\n * @param {Number} bigbluebuttonbnid bigblubeutton identifier\n * @param {Number} pollInterval poll interval in miliseconds\n */\nexport const init = (bigbluebuttonbnid, pollInterval) => {\n const completionElement = document.querySelector('a[href*=completion_validate]');\n if (completionElement) {\n completionElement.addEventListener(\"click\", event => {\n event.preventDefault();\n\n const pendingPromise = new Pending('mod_bigbluebuttonbn/completion:validate');\n\n repository.completionValidate(bigbluebuttonbnid)\n .then(() => getString('completionvalidatestatetriggered', 'mod_bigbluebuttonbn'))\n .then(str => addToast(str))\n .then(() => pendingPromise.resolve())\n .catch(displayException);\n });\n }\n\n document.addEventListener('click', e => {\n const joinButton = e.target.closest('[data-action=\"join\"]');\n if (joinButton) {\n window.open(joinButton.href, 'bigbluebutton_conference');\n e.preventDefault();\n // Gives the user a bit of time to go into the meeting before polling the room.\n setTimeout(() => {\n roomUpdater.updateRoom(true);\n }, pollInterval);\n }\n });\n\n document.addEventListener(eventTypes.sessionEnded, () => {\n roomUpdater.stop();\n roomUpdater.updateRoom();\n fetchNotifications();\n });\n\n window.addEventListener(eventTypes.currentSessionEnded, () => {\n roomUpdater.stop();\n roomUpdater.updateRoom();\n fetchNotifications();\n });\n // Room update.\n roomUpdater.start(pollInterval);\n};\n\n/**\n * Auto close child windows when clicking the End meeting button.\n * @param {Number} closeDelay time to wait in miliseconds before closing the window\n */\nexport const setupWindowAutoClose = (closeDelay = 2000) => {\n notifyCurrentSessionEnded(window.opener);\n window.addEventListener('onbeforeunload', () => {\n window.opener.setTimeout(() => {\n roomUpdater.updateRoom(true);\n }, closeDelay);\n },\n {\n once: true\n });\n window.close(); // This does not work as scripts can only close windows that are opened by themselves.\n};\n"],"names":["bigbluebuttonbnid","pollInterval","completionElement","document","querySelector","addEventListener","event","preventDefault","pendingPromise","Pending","repository","completionValidate","then","str","resolve","catch","displayException","e","joinButton","target","closest","window","open","href","setTimeout","roomUpdater","updateRoom","eventTypes","sessionEnded","stop","currentSessionEnded","start","closeDelay","opener","once","close"],"mappings":";;;;;;;wRAyCoB,CAACA,kBAAmBC,sBAC9BC,kBAAoBC,SAASC,cAAc,gCAC7CF,mBACAA,kBAAkBG,iBAAiB,SAASC,QACxCA,MAAMC,uBAEAC,eAAiB,IAAIC,iBAAQ,2CAEnCC,WAAWC,mBAAmBX,mBACzBY,MAAK,KAAM,mBAAU,mCAAoC,yBACzDA,MAAKC,MAAO,cAASA,OACrBD,MAAK,IAAMJ,eAAeM,YAC1BC,MAAMC,4BAInBb,SAASE,iBAAiB,SAASY,UACzBC,WAAaD,EAAEE,OAAOC,QAAQ,wBAChCF,aACAG,OAAOC,KAAKJ,WAAWK,KAAM,4BAC7BN,EAAEV,iBAEFiB,YAAW,KACPC,YAAYC,YAAW,KACxBzB,kBAIXE,SAASE,iBAAiBsB,mBAAWC,cAAc,KAC/CH,YAAYI,OACZJ,YAAYC,uDAIhBL,OAAOhB,iBAAiBsB,mBAAWG,qBAAqB,KACpDL,YAAYI,OACZJ,YAAYC,uDAIhBD,YAAYM,MAAM9B,6CAOc,eAAC+B,kEAAa,0CACpBX,OAAOY,QACjCZ,OAAOhB,iBAAiB,kBAAkB,KAClCgB,OAAOY,OAAOT,YAAW,KACrBC,YAAYC,YAAW,KACxBM,cAEP,CACIE,MAAM,IAEdb,OAAOc"} \ No newline at end of file diff --git a/mod/bigbluebuttonbn/amd/src/rooms.js b/mod/bigbluebuttonbn/amd/src/rooms.js index da72f10ba07..a6b71afc81d 100644 --- a/mod/bigbluebuttonbn/amd/src/rooms.js +++ b/mod/bigbluebuttonbn/amd/src/rooms.js @@ -28,7 +28,9 @@ import { exception as displayException, fetchNotifications, } from 'core/notification'; - +import Pending from 'core/pending'; +import {get_string as getString} from 'core/str'; +import {add as addToast} from 'core/toast'; import {eventTypes, notifyCurrentSessionEnded} from './events'; /** @@ -40,8 +42,16 @@ import {eventTypes, notifyCurrentSessionEnded} from './events'; export const init = (bigbluebuttonbnid, pollInterval) => { const completionElement = document.querySelector('a[href*=completion_validate]'); if (completionElement) { - completionElement.addEventListener("click", () => { - repository.completionValidate(bigbluebuttonbnid).catch(displayException); + completionElement.addEventListener("click", event => { + event.preventDefault(); + + const pendingPromise = new Pending('mod_bigbluebuttonbn/completion:validate'); + + repository.completionValidate(bigbluebuttonbnid) + .then(() => getString('completionvalidatestatetriggered', 'mod_bigbluebuttonbn')) + .then(str => addToast(str)) + .then(() => pendingPromise.resolve()) + .catch(displayException); }); } diff --git a/mod/bigbluebuttonbn/tests/behat/completion.feature b/mod/bigbluebuttonbn/tests/behat/completion.feature index 9235cca7fef..44078904ef4 100644 --- a/mod/bigbluebuttonbn/tests/behat/completion.feature +++ b/mod/bigbluebuttonbn/tests/behat/completion.feature @@ -1,9 +1,8 @@ @mod @mod_bigbluebuttonbn Feature: As a user I can complete a BigblueButtonBN activity by usual or custom criteria - Background: Make sure that a course is created - Given a BigBlueButton mock server is configured - And I accept dpa and enable bigbluebuttonbn plugin + Background: + Given I accept dpa and enable bigbluebuttonbn plugin And the following "courses" exist: | fullname | shortname | category | enablecompletion | | Test course | C1 | 0 | 1 | @@ -31,9 +30,10 @@ Feature: As a user I can complete a BigblueButtonBN activity by usual or custom @javascript Scenario: I set the completion type to custom completion - Given the following config values are set as admin: + Given a BigBlueButton mock server is configured + And the following config values are set as admin: | bigbluebuttonbn_meetingevents_enabled | 1 | - And I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin + When I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin And I click on "Settings" "link" And I expand all fieldsets And I set the following fields to these values: @@ -61,3 +61,11 @@ Feature: As a user I can complete a BigblueButtonBN activity by usual or custom And I run all adhoc tasks And I reload the page Then I should see "Done: Participate in 1 chat(s)" + + @javascript + Scenario: Validate completion when registering live sessions + Given the following config values are set as admin: + | bigbluebuttonbn_meetingevents_enabled | 1 | + When I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin + And I click on "Validate completion" "link" + Then I should see "Validate completion has been triggered."