fix: Folder limit cannot be empty #97

This commit is contained in:
rustmailer
2026-01-05 21:32:00 +08:00
parent 0bf2003670
commit 55e97510c4
7 changed files with 29 additions and 10 deletions
+6
View File
@@ -421,6 +421,12 @@ impl AccountV3 {
new.folder_limit = Some(folder_limit);
}
if let Some(clear_folder_limit) = request.clear_folder_limit {
if clear_folder_limit {
new.folder_limit = None;
}
}
if let Some(name) = &request.name {
if name.trim().is_empty() {
new.name = None;
+8
View File
@@ -127,6 +127,7 @@ pub struct AccountUpdateRequest {
/// otherwise sync up to `n` most recent emails (min 10).
#[oai(validator(minimum(value = "100")))]
pub folder_limit: Option<u32>,
pub clear_folder_limit: Option<bool>,
/// Configuration for selective folder (mailbox/label) synchronization
///
/// - For IMAP/SMTP accounts:
@@ -166,6 +167,13 @@ impl AccountUpdateRequest {
));
}
if self.clear_folder_limit == Some(true) && self.folder_limit.is_some() {
return Err(raise_error!(
"clear_folder_limit cannot be combined with folder_limit".into(),
ErrorCode::InvalidParameter
));
}
if self.clear_date_range == Some(true)
&& (self.date_since.is_some() || self.date_before.is_some())
{