From 7b9233f3cce2c1ea8b2c95a1dceb96288131d7d7 Mon Sep 17 00:00:00 2001 From: Corey Peterson Date: Tue, 17 Sep 2024 14:46:35 -0400 Subject: [PATCH] Changes generation enabled error boundary. Updates dev docker compose env variable imports --- docker/docker-compose.override.yml | 19 +++---------------- fuel/app/classes/materia/api/v1.php | 2 +- fuel/app/tests/api/v1.php | 8 +++++++- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/docker/docker-compose.override.yml b/docker/docker-compose.override.yml index 6b209badd..06ac82046 100644 --- a/docker/docker-compose.override.yml +++ b/docker/docker-compose.override.yml @@ -15,22 +15,9 @@ services: - ./config/nginx/nginx-dev.conf:/etc/nginx/nginx.conf:ro app: - environment: - # values sourced from docker/env - - ASSET_STORAGE_DRIVER - - ASSET_STORAGE_S3_CREDENTIAL_PROVIDER - - ASSET_STORAGE_S3_BUCKET - - ASSET_STORAGE_S3_ENDPOINT - - ASSET_STORAGE_S3_KEY - - ASSET_STORAGE_S3_SECRET - - GENERATION_ENABLED - - GENERATION_ALLOW_IMAGES - - GENERATION_API_PROVIDER - - GENERATION_API_ENDPOINT - - GENERATION_API_KEY - - GENERATION_API_VERSION - - GENERATION_API_MODEL - - GENERATION_LOG_STATS + env_file: + - .env + - .env.local volumes: - ..:/var/www/html/ - uploaded_widgets:/var/www/html/public/widget/ diff --git a/fuel/app/classes/materia/api/v1.php b/fuel/app/classes/materia/api/v1.php index 095cefc32..b250c4575 100644 --- a/fuel/app/classes/materia/api/v1.php +++ b/fuel/app/classes/materia/api/v1.php @@ -854,7 +854,7 @@ static public function question_set_get($inst_id, $play_id = null, $timestamp = static public function question_set_generate($inst_id, $widget_id, $topic, $include_images, $num_questions, $build_off_existing) { // short-circuit if generation is not available - if ( ! Widget_Question_Generator::is_enabled()) return Msg::not_found(); + if ( ! Widget_Question_Generator::is_enabled()) return Msg::failure(); // verify eligibility if ( ! \Service_User::verify_session(['basic_author', 'super_user'])) return Msg::no_perm(); diff --git a/fuel/app/tests/api/v1.php b/fuel/app/tests/api/v1.php index bc6b5d6ed..a9ff19737 100644 --- a/fuel/app/tests/api/v1.php +++ b/fuel/app/tests/api/v1.php @@ -1138,7 +1138,7 @@ public function test_question_set_generate() if ( ! \Materia\Widget_Question_Generator::is_enabled()) { $output = Api_V1::question_set_generate(null, 1, 'Pixar Films', false, 8, false); - $this->assert_not_found_message($output); + $this->assert_failure_message($output); } else { @@ -1655,6 +1655,12 @@ protected function assert_not_found_message($msg) $this->assertEquals('Not Found', $msg->title); } + protected function assert_failure_message($msg) + { + $this->assertInstanceOf('\Materia\Msg', $msg); + $this->assertEquals('Action Failed', $msg->title); + } + protected function assert_permission_denied_message($msg) { $this->assertInstanceOf('\Materia\Msg', $msg);