From 533d7924d6dbefe7d6cdc84cac444e5675a34bf7 Mon Sep 17 00:00:00 2001 From: wiaderwek Date: Mon, 18 Mar 2024 16:57:27 +0100 Subject: [PATCH 1/2] change users/admin get routes to v3 (#3417) * change users/admin get routes to v3 * add missing version param * fix students request * add sorting param * fix sort --------- Co-authored-by: Tomasz Wiaderek --- controllers/administration.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/controllers/administration.js b/controllers/administration.js index e303173ad4..ff03d04d95 100644 --- a/controllers/administration.js +++ b/controllers/administration.js @@ -960,7 +960,7 @@ router.get( '/teachers/:id/edit', permissionsHelper.permissionsChecker(['ADMIN_VIEW', 'TEACHER_EDIT'], 'or'), (req, res, next) => { - const userPromise = api(req).get(`users/admin/teachers/${req.params.id}`); + const userPromise = api(req, { version: 'v3' }).get(`users/admin/teachers/${req.params.id}`); const classesPromise = getSelectOptions(req, 'classes', { $populate: ['year'], $sort: 'displayName', @@ -1119,7 +1119,7 @@ router.get( '/students/:id/skipregistration', permissionsHelper.permissionsChecker('STUDENT_SKIP_REGISTRATION'), (req, res, next) => { - api(req).get(`/users/admin/students/${req.params.id}`) + api(req, { version: 'v3' }).get(`/users/admin/students/${req.params.id}`) .then((user) => { res.render('administration/users_skipregistration', { title: res.$t('administration.controller.link.toGiveConsent'), @@ -1165,7 +1165,7 @@ router.get( $skip: itemsPerPage * (currentPage - 1), }; query = Object.assign(query, filterQuery); - api(req) + api(req, { version: 'v3' }) .get('/users/admin/students', { qs: query, }) @@ -1288,13 +1288,14 @@ const getUsersWithoutConsent = async (req, roleName, classId) => { const batchSize = 50; while (users.length > 0) { usersWithMissingConsents.push( - ...(await api(req).get('/users/admin/students', { + ...(await api(req, { version: 'v3' }).get('/users/admin/students', { qs: { users: users .splice(0, batchSize) .map((u) => u._id), - consentStatus: ['missing', 'parentsAgreed'], + consentStatus: { $in: ['missing', 'parentsAgreed'] }, $limit: batchSize, + $sort: { 'lastName': 1}, }, })).data, ); @@ -1400,7 +1401,7 @@ router.get( '/students/:id/edit', permissionsHelper.permissionsChecker(['ADMIN_VIEW', 'STUDENT_EDIT'], 'or'), (req, res, next) => { - const userPromise = api(req).get(`/users/admin/students/${req.params.id}`); + const userPromise = api(req, { version: 'v3' }).get(`/users/admin/students/${req.params.id}`); const accountPromise = api(req, { json: true, version: 'v3' }) .get('/account', { qs: { type: 'userId', value: req.params.id }, From e53aac68068fc1b7da5aaa6ed6d3028e49798af3 Mon Sep 17 00:00:00 2001 From: Uwe Ilgenstein Date: Wed, 20 Mar 2024 12:04:22 +0100 Subject: [PATCH 2/2] BC-6752 - Fix H5P editor loading (#3429) --- static/scripts/topicEdit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/scripts/topicEdit.js b/static/scripts/topicEdit.js index 1865c3b438..b930666340 100644 --- a/static/scripts/topicEdit.js +++ b/static/scripts/topicEdit.js @@ -1065,7 +1065,7 @@ class TopicH5P extends TopicBlock { const { parentType, parentId } = this.props; const editorPopup = window.open( - `/h5p/editor/${id ?? ''}?parentType=${parentType}&parentId=${parentId}&inline=1`, + `/h5p/editor/${id ?? 'new'}?parentType=${parentType}&parentId=${parentId}&inline=1`, 'h5p-editor', `width=${w}, height=${h}, left=${x}, top=${y}, fullscreen=yes, toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=yes`,