From eedbfd6dde6de1451bd0bef59fd70a2c13489448 Mon Sep 17 00:00:00 2001
From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de>
Date: Fri, 28 May 2021 16:04:47 +0200
Subject: [PATCH] switch default for `files_hidden` option to 1, fixes #65

---
 exercises/Exercise.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/exercises/Exercise.php b/exercises/Exercise.php
index 367b8e9..ac70c84 100644
--- a/exercises/Exercise.php
+++ b/exercises/Exercise.php
@@ -118,7 +118,7 @@ abstract class Exercise extends SimpleORMap
             $this->options['comment'] = 1;
         }
 
-        if ($request['file_ids'] && !$request['files_visible']) {
+        if (!$request['files_visible']) {
             $this->options['files_hidden'] = 1;
         }
     }
@@ -662,6 +662,10 @@ abstract class Exercise extends SimpleORMap
      */
     public function includeFilesForExport()
     {
+        if (count($this->files) == 0) {
+            $this->options['files_hidden'] = 1;
+        }
+
         $this->description = $this->rewriteLinksForExport($this->description);
         $this->options['hint'] = $this->rewriteLinksForExport($this->options['hint']);
         $this->task = $this->rewriteLinksForExport($this->task);
-- 
GitLab