diff options
| author | André Noack <noack@data-quest.de> | 2024-04-04 14:00:32 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2024-04-04 16:08:50 +0200 |
| commit | 0e5da23555c11cb95974a9ecf78ca1378c1e3e97 (patch) | |
| tree | 93ab944d48198f944ffc9a115b767058b5a479e5 | |
| parent | 3159b8c094f8fb3459326debe981ee4f798243fc (diff) | |
Resolve #2956 "Verlinkung bei der Raumverwaltung > Auflösen von Raumanfragen"
Closes #2956
Merge request studip/studip!1990
| -rw-r--r-- | app/controllers/resources/room_request.php | 4 | ||||
| -rw-r--r-- | app/views/course/timesrooms/_roomRequest.php | 3 | ||||
| -rw-r--r-- | resources/assets/javascripts/lib/extract_callback.js | 5 | ||||
| -rw-r--r-- | tests/jest/extract_callback.test.js | 10 |
4 files changed, 6 insertions, 16 deletions
diff --git a/app/controllers/resources/room_request.php b/app/controllers/resources/room_request.php index fec5262..d962106 100644 --- a/app/controllers/resources/room_request.php +++ b/app/controllers/resources/room_request.php @@ -1739,8 +1739,8 @@ class Resources_RoomRequestController extends AuthenticatedController if ($save_only) { // redirect to reload all infos and showing the most current ones $this->redirect('resources/room_request/resolve/' . $request_id); - } elseif (Request::isDialog() && Context::get()) { - $this->response->add_header('X-Dialog-Execute', '{"func": "STUDIP.AdminCourses.App.loadCourse", "payload": "'.Context::get()->id.'"}'); + } elseif (Request::isDialog() && Context::get()->id) { + $this->response->add_header('X-Dialog-Execute', '{"func": "STUDIP.AdminCourses.App.loadCourse", "payload": "' . Context::get()->id . '"}'); } } diff --git a/app/views/course/timesrooms/_roomRequest.php b/app/views/course/timesrooms/_roomRequest.php index 989fccb..ffa72b0 100644 --- a/app/views/course/timesrooms/_roomRequest.php +++ b/app/views/course/timesrooms/_roomRequest.php @@ -93,8 +93,7 @@ ), _('Diese Anfrage selbst auflösen'), Icon::create('admin'), - ['title' => _('Diese Anfrage selbst auflösen')], - ['data-dialog' => '1'] + ['title' => _('Diese Anfrage selbst auflösen'), 'data-dialog' => ''] ) ?> <? endif ?> <? $actionMenu->addLink( diff --git a/resources/assets/javascripts/lib/extract_callback.js b/resources/assets/javascripts/lib/extract_callback.js index bf7ac79..a630275 100644 --- a/resources/assets/javascripts/lib/extract_callback.js +++ b/resources/assets/javascripts/lib/extract_callback.js @@ -56,8 +56,9 @@ export default function extractCallback(cmd, payload, root = window) { } } - if (callback[chunk] === undefined) { - throw 'Error: Undefined callback ' + cmd; + if (callback === null || callback[chunk] === undefined) { + console.log('Error: Undefined callback ' + cmd); + return; } if (typeof callback[chunk] === 'function' && parameters !== null) { diff --git a/tests/jest/extract_callback.test.js b/tests/jest/extract_callback.test.js index d67d7e6..895aa8d 100644 --- a/tests/jest/extract_callback.test.js +++ b/tests/jest/extract_callback.test.js @@ -108,14 +108,4 @@ describe('extract_callback()', () => { expect(callback).toHaveBeenCalledWith(['foo', 23]); }) - - test('invalid', () => { - expect(() => { - extractCallback('callback', {}, {}); - }).toThrow(); - - expect(() => { - extractCallback('{}', {}, {}); - }).toThrow(); - }) }); |
