This commit is contained in:
Víctor Déniz
2022-04-27 15:56:00 +06:00
committed by Ilya Tregubov
8 changed files with 33 additions and 17 deletions
+1 -1
View File
@@ -5,6 +5,6 @@ define("mod_bigbluebuttonbn/rooms",["exports","./actions","./repository","./room
* @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=>{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())})),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()};const autoclose=()=>{window.opener.setTimeout((()=>{roomUpdater.updateRoom(!0)}),5e3),window.removeEventListener("onbeforeunload",autoclose)};_exports.setupWindowAutoClose=()=>{(0,_events.notifyCurrentSessionEnded)(window.opener),window.addEventListener("onbeforeunload",autoclose),window.close()}}));
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.setupWindowAutoClose=_exports.init=void 0,repository=_interopRequireWildcard(repository),roomUpdater=_interopRequireWildcard(roomUpdater);_exports.init=bigbluebuttonbnid=>{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)}),5e3))})),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()};const autoclose=()=>{window.opener.setTimeout((()=>{roomUpdater.updateRoom(!0)}),5e3),window.removeEventListener("onbeforeunload",autoclose)};_exports.setupWindowAutoClose=()=>{(0,_events.notifyCurrentSessionEnded)(window.opener),window.addEventListener("onbeforeunload",autoclose),window.close()}}));
//# sourceMappingURL=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 <http://www.gnu.org/licenses/>.\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\nexport const init = (bigbluebuttonbnid) => {\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 }\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();\n};\n\n/**\n * Handle autoclosing of the window.\n */\nconst autoclose = () => {\n window.opener.setTimeout(() => {\n roomUpdater.updateRoom(true);\n }, 5000);\n window.removeEventListener('onbeforeunload', autoclose);\n};\n\n/**\n * Auto close child windows when clicking the End meeting button.\n */\nexport const setupWindowAutoClose = () => {\n notifyCurrentSessionEnded(window.opener);\n window.addEventListener('onbeforeunload', autoclose);\n\n window.close(); // This does not work as scripts can only close windows that are opened by themselves.\n};\n"],"names":["bigbluebuttonbnid","completionElement","document","querySelector","addEventListener","repository","completionValidate","catch","displayException","e","joinButton","target","closest","window","open","href","preventDefault","eventTypes","sessionEnded","roomUpdater","stop","updateRoom","currentSessionEnded","start","autoclose","opener","setTimeout","removeEventListener","close"],"mappings":";;;;;;;8NAiCqBA,0BACXC,kBAAoBC,SAASC,cAAc,gCAC7CF,mBACAA,kBAAkBG,iBAAiB,SAAS,KACxCC,WAAWC,mBAAmBN,mBAAmBO,MAAMC,4BAI/DN,SAASE,iBAAiB,SAASK,UACzBC,WAAaD,EAAEE,OAAOC,QAAQ,wBAChCF,aACAG,OAAOC,KAAKJ,WAAWK,KAAM,4BAC7BN,EAAEO,qBAIVd,SAASE,iBAAiBa,mBAAWC,cAAc,KAC/CC,YAAYC,OACZD,YAAYE,uDAIhBR,OAAOT,iBAAiBa,mBAAWK,qBAAqB,KACpDH,YAAYC,OACZD,YAAYE,uDAIhBF,YAAYI,eAMVC,UAAY,KACdX,OAAOY,OAAOC,YAAW,KACrBP,YAAYE,YAAW,KACxB,KACHR,OAAOc,oBAAoB,iBAAkBH,0CAMb,2CACNX,OAAOY,QACjCZ,OAAOT,iBAAiB,iBAAkBoB,WAE1CX,OAAOe"}
{"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 <http://www.gnu.org/licenses/>.\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\nconst timeoutjoin = 5000;\n\nexport const init = (bigbluebuttonbnid) => {\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.\n setTimeout(() => {\n roomUpdater.updateRoom(true);\n }, timeoutjoin);\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();\n};\n\n/**\n * Handle autoclosing of the window.\n */\nconst autoclose = () => {\n window.opener.setTimeout(() => {\n roomUpdater.updateRoom(true);\n }, timeoutjoin);\n window.removeEventListener('onbeforeunload', autoclose);\n};\n\n/**\n * Auto close child windows when clicking the End meeting button.\n */\nexport const setupWindowAutoClose = () => {\n notifyCurrentSessionEnded(window.opener);\n window.addEventListener('onbeforeunload', autoclose);\n\n window.close(); // This does not work as scripts can only close windows that are opened by themselves.\n};\n"],"names":["bigbluebuttonbnid","completionElement","document","querySelector","addEventListener","repository","completionValidate","catch","displayException","e","joinButton","target","closest","window","open","href","preventDefault","setTimeout","roomUpdater","updateRoom","eventTypes","sessionEnded","stop","currentSessionEnded","start","autoclose","opener","removeEventListener","close"],"mappings":";;;;;;;8NAmCqBA,0BACXC,kBAAoBC,SAASC,cAAc,gCAC7CF,mBACAA,kBAAkBG,iBAAiB,SAAS,KACxCC,WAAWC,mBAAmBN,mBAAmBO,MAAMC,4BAI/DN,SAASE,iBAAiB,SAASK,UACzBC,WAAaD,EAAEE,OAAOC,QAAQ,wBAChCF,aACAG,OAAOC,KAAKJ,WAAWK,KAAM,4BAC7BN,EAAEO,iBAEFC,YAAW,KACPC,YAAYC,YAAW,KAjBnB,SAsBhBjB,SAASE,iBAAiBgB,mBAAWC,cAAc,KAC/CH,YAAYI,OACZJ,YAAYC,uDAIhBN,OAAOT,iBAAiBgB,mBAAWG,qBAAqB,KACpDL,YAAYI,OACZJ,YAAYC,uDAIhBD,YAAYM,eAMVC,UAAY,KACdZ,OAAOa,OAAOT,YAAW,KACrBC,YAAYC,YAAW,KA1CX,KA4ChBN,OAAOc,oBAAoB,iBAAkBF,0CAMb,2CACNZ,OAAOa,QACjCb,OAAOT,iBAAiB,iBAAkBqB,WAE1CZ,OAAOe"}
+1 -1
View File
@@ -5,6 +5,6 @@ define("mod_bigbluebuttonbn/roomupdater",["exports","core/templates","core/notif
* @module mod_bigbluebuttonbn/roomupdater
* @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.updateRoom=_exports.stop=_exports.start=void 0,_templates=(obj=_templates)&&obj.__esModule?obj:{default:obj};let updateCount=0,updateFactor=1,timerReference=null,timerRunning=!1;_exports.start=()=>{timerRunning=!0,timerReference=setTimeout((()=>poll()),1e3)};_exports.stop=()=>{timerRunning=!1,timerReference&&(clearInterval(timerReference),timerReference=null),updateCount=0,updateFactor=1};const poll=()=>{timerRunning&&updateCount%updateFactor==0&&updateRoom(!0).then((()=>{updateFactor>=10?updateFactor=1:updateFactor++})).catch().then((()=>{timerReference=setTimeout((()=>poll()),1e3)})).catch()},updateRoom=function(){let updatecache=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const bbbRoomViewElement=document.getElementById("bbb-room-view"),bbbId=bbbRoomViewElement.dataset.bbbId,groupId=bbbRoomViewElement.dataset.groupId;return(0,_repository.getMeetingInfo)(bbbId,groupId,updatecache).then((data=>(data.haspresentations=!1,data.presentations&&data.presentations.length&&(data.haspresentations=!0),_templates.default.renderForPromise("mod_bigbluebuttonbn/room_view",data)))).then((_ref=>{let{html:html,js:js}=_ref;return _templates.default.replaceNodeContents(bbbRoomViewElement,html,js)})).catch(_notification.exception)};_exports.updateRoom=updateRoom}));
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.updateRoom=_exports.stop=_exports.start=void 0,_templates=(obj=_templates)&&obj.__esModule?obj:{default:obj};let updateCount=0,updateFactor=1,timerReference=null,timerRunning=!1;_exports.start=()=>{timerRunning=!0,timerReference=setTimeout((()=>poll()),5e3)};_exports.stop=()=>{timerRunning=!1,timerReference&&(clearInterval(timerReference),timerReference=null),updateCount=0,updateFactor=1};const poll=()=>{timerRunning&&updateCount%updateFactor==0&&updateRoom().then((()=>{updateFactor>=10?updateFactor=1:updateFactor++})).catch().then((()=>{timerReference=setTimeout((()=>poll()),5e3)})).catch()},updateRoom=function(){let updatecache=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const bbbRoomViewElement=document.getElementById("bbb-room-view"),bbbId=bbbRoomViewElement.dataset.bbbId,groupId=bbbRoomViewElement.dataset.groupId;return(0,_repository.getMeetingInfo)(bbbId,groupId,updatecache).then((data=>(data.haspresentations=!1,data.presentations&&data.presentations.length&&(data.haspresentations=!0),_templates.default.renderForPromise("mod_bigbluebuttonbn/room_view",data)))).then((_ref=>{let{html:html,js:js}=_ref;return _templates.default.replaceNodeContents(bbbRoomViewElement,html,js)})).catch(_notification.exception)};_exports.updateRoom=updateRoom}));
//# sourceMappingURL=roomupdater.min.js.map
@@ -1 +1 @@
{"version":3,"file":"roomupdater.min.js","sources":["../src/roomupdater.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * JS room updater.\n *\n * @module mod_bigbluebuttonbn/roomupdater\n * @copyright 2021 Blindside Networks Inc\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Templates from \"core/templates\";\nimport {exception as displayException} from 'core/notification';\nimport {getMeetingInfo} from './repository';\n\nconst timeout = 1000;\nconst maxFactor = 10;\n\nlet updateCount = 0;\nlet updateFactor = 1;\nlet timerReference = null;\nlet timerRunning = false;\n\nconst resetValues = () => {\n updateCount = 0;\n updateFactor = 1;\n};\n\n/**\n * Start the information poller.\n */\nexport const start = () => {\n timerRunning = true;\n timerReference = setTimeout(() => poll(), timeout);\n};\n\n/**\n * Stop the room updater.\n */\nexport const stop = () => {\n timerRunning = false;\n if (timerReference) {\n clearInterval(timerReference);\n timerReference = null;\n }\n\n resetValues();\n};\n\nconst poll = () => {\n if (!timerRunning) {\n // The poller has been stopped.\n return;\n }\n if ((updateCount % updateFactor) === 0) {\n updateRoom(true)\n .then(() => {\n if (updateFactor >= maxFactor) {\n updateFactor = 1;\n } else {\n updateFactor++;\n }\n\n return;\n\n })\n .catch()\n .then(() => {\n timerReference = setTimeout(() => poll(), timeout);\n return;\n })\n .catch();\n }\n};\n\n/**\n * Update the room information.\n *\n * @param {boolean} [updatecache=false]\n * @returns {Promise}\n */\nexport const updateRoom = (updatecache = false) => {\n const bbbRoomViewElement = document.getElementById('bbb-room-view');\n const bbbId = bbbRoomViewElement.dataset.bbbId;\n const groupId = bbbRoomViewElement.dataset.groupId;\n return getMeetingInfo(bbbId, groupId, updatecache)\n .then(data => {\n // Just make sure we have the right information for the template.\n data.haspresentations = false;\n if (data.presentations && data.presentations.length) {\n data.haspresentations = true;\n }\n return Templates.renderForPromise('mod_bigbluebuttonbn/room_view', data);\n })\n .then(({html, js}) => Templates.replaceNodeContents(bbbRoomViewElement, html, js))\n .catch(displayException);\n};\n"],"names":["updateCount","updateFactor","timerReference","timerRunning","setTimeout","poll","clearInterval","updateRoom","then","catch","updatecache","bbbRoomViewElement","document","getElementById","bbbId","dataset","groupId","data","haspresentations","presentations","length","Templates","renderForPromise","_ref","html","js","replaceNodeContents","displayException"],"mappings":";;;;;;;uLA8BIA,YAAc,EACdC,aAAe,EACfC,eAAiB,KACjBC,cAAe,iBAUE,KACjBA,cAAe,EACfD,eAAiBE,YAAW,IAAMC,QAlBtB,oBAwBI,KAChBF,cAAe,EACXD,iBACAI,cAAcJ,gBACdA,eAAiB,MAnBrBF,YAAc,EACdC,aAAe,SAwBbI,KAAO,KACJF,cAIAH,YAAcC,cAAkB,GACjCM,YAAW,GACVC,MAAK,KACEP,cAzCE,GA0CFA,aAAe,EAEfA,kBAMPQ,QACAD,MAAK,KACFN,eAAiBE,YAAW,IAAMC,QArD9B,QAwDPI,SAUIF,WAAa,eAACG,0EACjBC,mBAAqBC,SAASC,eAAe,iBAC7CC,MAAQH,mBAAmBI,QAAQD,MACnCE,QAAUL,mBAAmBI,QAAQC,eACpC,8BAAeF,MAAOE,QAASN,aACjCF,MAAKS,OAEFA,KAAKC,kBAAmB,EACpBD,KAAKE,eAAiBF,KAAKE,cAAcC,SACzCH,KAAKC,kBAAmB,GAErBG,mBAAUC,iBAAiB,gCAAiCL,SAEtET,MAAKe,WAACC,KAACA,KAADC,GAAOA,gBAAQJ,mBAAUK,oBAAoBf,mBAAoBa,KAAMC,OAC7EhB,MAAMkB"}
{"version":3,"file":"roomupdater.min.js","sources":["../src/roomupdater.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * JS room updater.\n *\n * @module mod_bigbluebuttonbn/roomupdater\n * @copyright 2021 Blindside Networks Inc\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Templates from \"core/templates\";\nimport {exception as displayException} from 'core/notification';\nimport {getMeetingInfo} from './repository';\n\nconst timeout = 5000;\nconst maxFactor = 10;\n\nlet updateCount = 0;\nlet updateFactor = 1;\nlet timerReference = null;\nlet timerRunning = false;\n\nconst resetValues = () => {\n updateCount = 0;\n updateFactor = 1;\n};\n\n/**\n * Start the information poller.\n */\nexport const start = () => {\n timerRunning = true;\n timerReference = setTimeout(() => poll(), timeout);\n};\n\n/**\n * Stop the room updater.\n */\nexport const stop = () => {\n timerRunning = false;\n if (timerReference) {\n clearInterval(timerReference);\n timerReference = null;\n }\n\n resetValues();\n};\n\nconst poll = () => {\n if (!timerRunning) {\n // The poller has been stopped.\n return;\n }\n if ((updateCount % updateFactor) === 0) {\n updateRoom()\n .then(() => {\n if (updateFactor >= maxFactor) {\n updateFactor = 1;\n } else {\n updateFactor++;\n }\n\n return;\n\n })\n .catch()\n .then(() => {\n timerReference = setTimeout(() => poll(), timeout);\n return;\n })\n .catch();\n }\n};\n\n/**\n * Update the room information.\n *\n * @param {boolean} [updatecache=false]\n * @returns {Promise}\n */\nexport const updateRoom = (updatecache = false) => {\n const bbbRoomViewElement = document.getElementById('bbb-room-view');\n const bbbId = bbbRoomViewElement.dataset.bbbId;\n const groupId = bbbRoomViewElement.dataset.groupId;\n return getMeetingInfo(bbbId, groupId, updatecache)\n .then(data => {\n // Just make sure we have the right information for the template.\n data.haspresentations = false;\n if (data.presentations && data.presentations.length) {\n data.haspresentations = true;\n }\n return Templates.renderForPromise('mod_bigbluebuttonbn/room_view', data);\n })\n .then(({html, js}) => Templates.replaceNodeContents(bbbRoomViewElement, html, js))\n .catch(displayException);\n};\n"],"names":["updateCount","updateFactor","timerReference","timerRunning","setTimeout","poll","clearInterval","updateRoom","then","catch","updatecache","bbbRoomViewElement","document","getElementById","bbbId","dataset","groupId","data","haspresentations","presentations","length","Templates","renderForPromise","_ref","html","js","replaceNodeContents","displayException"],"mappings":";;;;;;;uLA8BIA,YAAc,EACdC,aAAe,EACfC,eAAiB,KACjBC,cAAe,iBAUE,KACjBA,cAAe,EACfD,eAAiBE,YAAW,IAAMC,QAlBtB,oBAwBI,KAChBF,cAAe,EACXD,iBACAI,cAAcJ,gBACdA,eAAiB,MAnBrBF,YAAc,EACdC,aAAe,SAwBbI,KAAO,KACJF,cAIAH,YAAcC,cAAkB,GACjCM,aACCC,MAAK,KACEP,cAzCE,GA0CFA,aAAe,EAEfA,kBAMPQ,QACAD,MAAK,KACFN,eAAiBE,YAAW,IAAMC,QArD9B,QAwDPI,SAUIF,WAAa,eAACG,0EACjBC,mBAAqBC,SAASC,eAAe,iBAC7CC,MAAQH,mBAAmBI,QAAQD,MACnCE,QAAUL,mBAAmBI,QAAQC,eACpC,8BAAeF,MAAOE,QAASN,aACjCF,MAAKS,OAEFA,KAAKC,kBAAmB,EACpBD,KAAKE,eAAiBF,KAAKE,cAAcC,SACzCH,KAAKC,kBAAmB,GAErBG,mBAAUC,iBAAiB,gCAAiCL,SAEtET,MAAKe,WAACC,KAACA,KAADC,GAAOA,gBAAQJ,mBAAUK,oBAAoBf,mBAAoBa,KAAMC,OAC7EhB,MAAMkB"}
+7 -1
View File
@@ -31,6 +31,8 @@ import {
import {eventTypes, notifyCurrentSessionEnded} from './events';
const timeoutjoin = 5000;
export const init = (bigbluebuttonbnid) => {
const completionElement = document.querySelector('a[href*=completion_validate]');
if (completionElement) {
@@ -44,6 +46,10 @@ export const init = (bigbluebuttonbnid) => {
if (joinButton) {
window.open(joinButton.href, 'bigbluebutton_conference');
e.preventDefault();
// Gives the user a bit of time to go into the meeting.
setTimeout(() => {
roomUpdater.updateRoom(true);
}, timeoutjoin);
}
});
@@ -68,7 +74,7 @@ export const init = (bigbluebuttonbnid) => {
const autoclose = () => {
window.opener.setTimeout(() => {
roomUpdater.updateRoom(true);
}, 5000);
}, timeoutjoin);
window.removeEventListener('onbeforeunload', autoclose);
};
+2 -2
View File
@@ -25,7 +25,7 @@ import Templates from "core/templates";
import {exception as displayException} from 'core/notification';
import {getMeetingInfo} from './repository';
const timeout = 1000;
const timeout = 5000;
const maxFactor = 10;
let updateCount = 0;
@@ -65,7 +65,7 @@ const poll = () => {
return;
}
if ((updateCount % updateFactor) === 0) {
updateRoom(true)
updateRoom()
.then(() => {
if (updateFactor >= maxFactor) {
updateFactor = 1;
+19 -10
View File
@@ -233,16 +233,17 @@ class meeting {
// This might raise an exception if info cannot be retrieved.
// But this might be totally fine as the meeting is maybe not yet created on BBB side.
$participantcount = 0;
try {
$info = self::retrieve_cached_meeting_info($this->instance->get_meeting_id(), $updatecache);
// This is the default value for any meeting that has not been created.
$meetinginfo->statusrunning = false;
$meetinginfo->createtime = null;
$info = self::retrieve_cached_meeting_info($this->instance->get_meeting_id(), $updatecache);
if (!empty($info)) {
$meetinginfo->statusrunning = $info['running'] === 'true';
$meetinginfo->createtime = $info['createTime'] ?? null;
$participantcount = isset($info['participantCount']) ? $info['participantCount'] : 0;
} catch (bigbluebutton_exception $e) {
// The meeting is not created on BBB side, so we have to setup a couple of values here.
$meetinginfo->statusrunning = false;
$meetinginfo->createtime = null;
}
$meetinginfo->statusclosed = $activitystatus === 'ended';
$meetinginfo->statusopen = !$meetinginfo->statusrunning && $activitystatus === 'open';
$meetinginfo->participantcount = $participantcount;
@@ -324,11 +325,19 @@ class meeting {
// Use the value in the cache.
return (array) json_decode($result['meeting_info']);
}
$cache->delete($meetingid); // Make sure we purges the cache before checking info.
// We set the cache to an empty value so then if get_meeting_info raises an exception we still have the
// info about the last creation_time, so we don't ask the server again for a bit.
$defaultcacheinfo = ['creation_time' => time(), 'meeting_info' => '[]'];
// Pings again and refreshes the cache.
$meetinginfo = bigbluebutton_proxy::get_meeting_info($meetingid);
$cache->set($meetingid, ['creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)]);
try {
$meetinginfo = bigbluebutton_proxy::get_meeting_info($meetingid);
$cache->set($meetingid, ['creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)]);
} catch (bigbluebutton_exception $e) {
// The meeting is not created on BBB side, so we set the value in the cache so we don't poll again
// and return an empty array.
$cache->set($meetingid, $defaultcacheinfo);
return [];
}
return $meetinginfo;
}
@@ -173,6 +173,7 @@ trait testcase_helper_trait {
$bbbgenerator = $this->getDataGenerator()->get_plugin_generator('mod_bigbluebuttonbn');
// Create the meetings on the mock server, so like this we can find the recordings.
$meeting = new meeting($instance);
$meeting->update_cache(); // The meeting has just been created but we need to force fetch info from the server.
if (!$meeting->is_running()) {
$additionalmeetingdata = array_merge([
'instanceid' => $instance->get_instance_id(),