show some text instead of nothing on empty quota list

some providers say that they support QUOTA in the IMAP CAPABILITY,
but return an empty list without any quota information then.

in our "Connectivity", this looks a bit of an error.

i have not seen this error often - only for testrun.org -
if it is usual, we could also just say "not supported"
(as we do in case QUOTA is not returned).
a translations seems not to be needed for now,
it seems unusual, and all other errors are not translated as well.
This commit is contained in:
B. Petersen
2023-04-01 16:29:17 +02:00
committed by bjoern
parent 044478a044
commit 9d8e836fdd
2 changed files with 64 additions and 55 deletions

View File

@@ -10,6 +10,7 @@
### Fixes ### Fixes
- Fix python bindings README documentation on installing the bindings from source. - Fix python bindings README documentation on installing the bindings from source.
- Show a warning if quota list is empty #4261
## [1.112.5] - 2023-04-02 ## [1.112.5] - 2023-04-02

View File

@@ -398,7 +398,7 @@ impl Context {
if let Some(quota) = &*quota { if let Some(quota) = &*quota {
match &quota.recent { match &quota.recent {
Ok(quota) => { Ok(quota) => {
let roots_cnt = quota.len(); if quota.len() > 0 {
for (root_name, resources) in quota { for (root_name, resources) in quota {
use async_imap::types::QuotaResourceName::*; use async_imap::types::QuotaResourceName::*;
for resource in resources { for resource in resources {
@@ -406,11 +406,16 @@ impl Context {
// root name is empty eg. for gmail and redundant eg. for riseup. // root name is empty eg. for gmail and redundant eg. for riseup.
// therefore, use it only if there are really several roots. // therefore, use it only if there are really several roots.
if roots_cnt > 1 && !root_name.is_empty() { if quota.len() > 1 && !root_name.is_empty() {
ret += ret += &format!(
&format!("<b>{}:</b> ", &*escaper::encode_minimal(root_name)); "<b>{}:</b> ",
&*escaper::encode_minimal(root_name)
);
} else { } else {
info!(self, "connectivity: root name hidden: \"{}\"", root_name); info!(
self,
"connectivity: root name hidden: \"{}\"", root_name
);
} }
let messages = stock_str::messages(self).await; let messages = stock_str::messages(self).await;
@@ -457,6 +462,9 @@ impl Context {
ret += "</li>"; ret += "</li>";
} }
} }
} else {
ret += format!("<li>Warning: {domain} claims to support quota but gives no information</li>").as_str();
}
} }
Err(e) => { Err(e) => {
ret += format!("<li>{e}</li>").as_str(); ret += format!("<li>{e}</li>").as_str();