Skip to content

Commit

Permalink
Changes generation enabled error boundary. Updates dev docker compose…
Browse files Browse the repository at this point in the history
… env variable imports
  • Loading branch information
clpetersonucf committed Sep 17, 2024
1 parent 0fa59af commit 7b9233f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
19 changes: 3 additions & 16 deletions docker/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion fuel/app/classes/materia/api/v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 7 additions & 1 deletion fuel/app/tests/api/v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7b9233f

Please sign in to comment.