Default folders: new accounts get an Archive folder #378
No files matched your search
@@ -2,6 +2,8 @@
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*
|
||||
* Modified by Coffey Labs in 2026 for INBUXA.
|
||||
*/
|
||||
|
||||
use ahash::{AHashMap, AHashSet};
|
||||
@@ -145,6 +147,7 @@ impl EmailConfig {
|
||||
}
|
||||
|
||||
// Parse default folders
|
||||
let configured_folders = !email.default_folders.is_empty();
|
||||
let mut default_folders = Vec::new();
|
||||
let mut shared_folder = "Shared Folders".to_string();
|
||||
for (special_use, folder) in email.default_folders {
|
||||
@@ -193,6 +196,18 @@ impl EmailConfig {
|
||||
});
|
||||
}
|
||||
}
|
||||
// INBUXA: with no folder list configured, new accounts also get an
|
||||
// Archive folder, which webmail and most clients expect (#374). A
|
||||
// configured list is the admin's choice and gets only the five above.
|
||||
if !configured_folders {
|
||||
default_folders.push(DefaultFolder {
|
||||
name: "Archive".to_string(),
|
||||
aliases: Vec::new(),
|
||||
special_use: SpecialUse::Archive,
|
||||
subscribe: true,
|
||||
create: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Search Index settings
|
||||
let mut index_fields = AHashMap::new();
|
||||
|
||||
@@ -14,7 +14,7 @@ if specialuse_exists "dingleberry" {
|
||||
error "An invalid special-use exists.";
|
||||
}
|
||||
|
||||
if specialuse_exists "archive" {
|
||||
if specialuse_exists "important" {
|
||||
error "A non-existent special-use exists.";
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ if not specialuse_exists "Deleted Items" "\\Trash" {
|
||||
error "Deleted Items has no Trash special-use (RFC 8579 attribute form).";
|
||||
}
|
||||
|
||||
if specialuse_exists "\\Archive" {
|
||||
if specialuse_exists "\\Important" {
|
||||
error "A non-existent special-use exists (RFC 8579 attribute form).";
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*
|
||||
* Modified by Coffey Labs in 2026 for INBUXA.
|
||||
*/
|
||||
|
||||
use crate::utils::server::TestServer;
|
||||
@@ -21,6 +23,45 @@ use types::id::Id;
|
||||
|
||||
pub async fn test(test: &TestServer) {
|
||||
println!("Running Mailbox tests...");
|
||||
|
||||
// INBUXA (#374): with no default folders configured, a new account gets
|
||||
// the five system folders plus Archive.
|
||||
let fresh = test
|
||||
.create_user_account(
|
||||
"admin",
|
||||
"[email protected]",
|
||||
"these_pretzels_are_making_me_thirsty",
|
||||
&[],
|
||||
"Archive default",
|
||||
)
|
||||
.await;
|
||||
let fresh_client = fresh.jmap_client().await;
|
||||
let mut request = fresh_client.build();
|
||||
request
|
||||
.get_mailbox()
|
||||
.properties([mailbox::Property::Name, mailbox::Property::Role]);
|
||||
let mut folders = request
|
||||
.send_get_mailbox()
|
||||
.await
|
||||
.unwrap()
|
||||
.take_list()
|
||||
.into_iter()
|
||||
.map(|m| (m.role(), m.name().unwrap_or_default().to_string()))
|
||||
.collect::<Vec<_>>();
|
||||
folders.sort_by_key(|(_, name)| name.clone());
|
||||
assert_eq!(
|
||||
folders,
|
||||
[
|
||||
(Role::Archive, "Archive".to_string()),
|
||||
(Role::Trash, "Deleted Items".to_string()),
|
||||
(Role::Drafts, "Drafts".to_string()),
|
||||
(Role::Inbox, "Inbox".to_string()),
|
||||
(Role::Junk, "Junk Mail".to_string()),
|
||||
(Role::Sent, "Sent Items".to_string()),
|
||||
]
|
||||
);
|
||||
test.account("admin").destroy_account(fresh).await;
|
||||
|
||||
let account = test.account("[email protected]");
|
||||
let client = account.jmap_client().await;
|
||||
|
||||
|
||||
Reference in new issue
Block a user