From e006b2b634eaf9f18bdbf252aabe15191483e68e Mon Sep 17 00:00:00 2001 From: ralf Date: Wed, 6 Mar 2024 15:46:36 +0200 Subject: [PATCH] * Mail: configurable limit to exclude attachments from automatic saving as drafts, default is no limit / attachments are always saved in drafts --- mail/inc/class.mail_compose.inc.php | 13 +++++++++++-- mail/lang/egw_de.lang | 1 + mail/lang/egw_en.lang | 1 + mail/templates/default/config.xet | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 5b2ff81be1..3c97d3f06a 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -2667,9 +2667,15 @@ class mail_compose break; } } - // attach files not for autosaving - elseif ($_formData['filemode'] == Vfs\Sharing::ATTACH && !$_autosaving) + // attach files not for autosaving, if size-limit is configured and attachment is bigger + elseif ($_formData['filemode'] == Vfs\Sharing::ATTACH) { + // exclude attachments greater configured size from autosaving + if ($_autosaving && !empty(Mail::$mailConfig['autosave_attachment_limit_mb']) && + $attachment['size'] > 1024*1024*Mail::$mailConfig['autosave_attachment_limit_mb']) + { + continue; + } if (isset($attachment['file']) && parse_url($attachment['file'],PHP_URL_SCHEME) == 'vfs') { Vfs::load_wrapper('vfs'); @@ -2761,6 +2767,9 @@ class mail_compose */ public function ajax_saveAsDraft ($content, $action='button[saveAsDraft]') { + // release session, as we don't need it and it blocks parallel requests + $GLOBALS['egw']->session->commit_session(); + //error_log(__METHOD__.__LINE__.array2string($content)."(, action=$action)"); $response = Api\Json\Response::get(); $success = true; diff --git a/mail/lang/egw_de.lang b/mail/lang/egw_de.lang index 06800af629..69f4e2b143 100644 --- a/mail/lang/egw_de.lang +++ b/mail/lang/egw_de.lang @@ -227,6 +227,7 @@ event details follow mail de Details zum Termin folgen every %1. day mail de Jeden %1. Tag everyone mail de Alle Anwender examine namespace to retrieve folders in others and shared mail de Den Namensraum untersuchen, um Ordner in anderen und gemeinsam genutzten Ordnern abzurufen +exclude attachments greater than given size from automatic saving as draft (in mb) admin de Schließe Anhänge größer als die angegebene Größe vom automatischen Speichern als Entwurf aus (in MB) extended mail de Erweitert extra sent folders mail de Anzeigeschema Gesendet-Ordner failed to delete %1 mail de Löschen von %1 fehlgeschlagen diff --git a/mail/lang/egw_en.lang b/mail/lang/egw_en.lang index 6d490989db..e68e27a9d0 100644 --- a/mail/lang/egw_en.lang +++ b/mail/lang/egw_en.lang @@ -227,6 +227,7 @@ event details follow mail en Event details follow every %1. day mail en Every %1. day everyone mail en Everyone examine namespace to retrieve folders in others and shared mail en Examine namespace to retrieve folders in others and shared +exclude attachments greater than given size from automatic saving as draft (in mb) admin en Exclude attachments greater than given size from automatic saving as draft (in MB) extended mail en Extended extra sent folders mail en Extra Sent Folders failed to delete %1 mail en Failed to delete %1 diff --git a/mail/templates/default/config.xet b/mail/templates/default/config.xet index ebac1ba737..af75eba318 100644 --- a/mail/templates/default/config.xet +++ b/mail/templates/default/config.xet @@ -126,6 +126,10 @@ + + + +