From 113d1881f2e1c1edb2f894585361d3f91a3fdc45 Mon Sep 17 00:00:00 2001 From: Steven Ngesera Date: Wed, 16 Oct 2024 23:07:02 +0300 Subject: [PATCH] Refact filter_expanded_folder_data output --- .github/workflows/Test-Build.yml | 8 ++++++++ modules/imap/functions.php | 7 +++++++ modules/imap/output_modules.php | 10 +--------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/Test-Build.yml b/.github/workflows/Test-Build.yml index 23d2ebe9e6..bacf61bc29 100644 --- a/.github/workflows/Test-Build.yml +++ b/.github/workflows/Test-Build.yml @@ -61,6 +61,10 @@ jobs: with: fetch-depth: 0 + - name: "Disable duplicate redis extension" + run: | + sudo sed -i '/redis.so/d' /etc/php/*/cli/conf.d/*redis.ini + - name: "Set up PHP" uses: shivammathur/setup-php@v2 with: @@ -120,6 +124,10 @@ jobs: sudo bash .github/tests/selenium/webdriver/webdriver.sh pip install -r tests/selenium/requirements.txt + - name: "Disable duplicate redis extension" + run: | + sudo sed -i '/redis.so/d' /etc/php/*/cli/conf.d/*redis.ini + - name: "Set up PHP" uses: shivammathur/setup-php@v2 with: diff --git a/modules/imap/functions.php b/modules/imap/functions.php index 0c19e5df0f..3dd58c16b6 100644 --- a/modules/imap/functions.php +++ b/modules/imap/functions.php @@ -159,7 +159,14 @@ function format_imap_folder_section($folders, $id, $output_mod, $with_input = fa if ($manage) { $results .= '
  • '.$output_mod->trans('Manage Folders').'
  • '; } + $f = $output_mod->get('folder', ''); + $quota = $output_mod->get('quota'); + $quota_max = $output_mod->get('quota_max'); + if (!$f && $quota) { + $results .= '
  • '.$quota.'% used on '.$quota_max.' MB
  • '; + } + $results .= ''; return $results; }} diff --git a/modules/imap/output_modules.php b/modules/imap/output_modules.php index 770cb6a6e6..e204ba9941 100644 --- a/modules/imap/output_modules.php +++ b/modules/imap/output_modules.php @@ -774,19 +774,11 @@ class Hm_Output_filter_expanded_folder_data extends Hm_Output_Module { * Build the HTML for a list of subfolders. The page cache is used to pass this to the folder list. */ protected function output() { - $res = ''; $folder_data = $this->get('imap_expanded_folder_data', array()); $with_input = $this->get('with_input', false); - $folder = $this->get('folder', ''); $can_share_folders = $this->get('can_share_folders', false); if (!empty($folder_data)) { - $res .= format_imap_folder_section($folder_data, $this->get('imap_expanded_folder_id'), $this, $with_input, $can_share_folders); - $quota = $this->get('quota'); - $quota_max = $this->get('quota_max'); - if (!$folder && $quota) { - $res .= '
  • '.$quota.'% used on '.$quota_max.' MB
  • '; - } - $res .= ''; + $res = format_imap_folder_section($folder_data, $this->get('imap_expanded_folder_id'), $this, $with_input, $can_share_folders); $this->out('imap_expanded_folder_formatted', $res); } }