Skip to content

Add support for archiving items#6916

Open
matt-aaron wants to merge 5 commits intodani-garcia:mainfrom
matt-aaron:archiving
Open

Add support for archiving items#6916
matt-aaron wants to merge 5 commits intodani-garcia:mainfrom
matt-aaron:archiving

Conversation

@matt-aaron
Copy link

Adds support for archiving items: #6372

I'm new to the codebase, so let me know if I have missed anything. Happy to apply any feedback you may have. Thank you!

Comment on lines +1715 to +1739
#[put("/ciphers/archive", data = "<data>")]
async fn archive_cipher_selected(
data: Json<CipherIdsData>,
headers: Headers,
conn: DbConn,
nt: Notify<'_>,
) -> JsonResult {
_set_archived_multiple_ciphers(data, &headers, true, &conn, &nt).await
}

#[put("/ciphers/<cipher_id>/unarchive")]
async fn unarchive_cipher_put(cipher_id: CipherId, headers: Headers, conn: DbConn, nt: Notify<'_>) -> JsonResult {
_set_archived_cipher_by_uuid(&cipher_id, &headers, false, false, &conn, &nt).await
}

#[put("/ciphers/unarchive", data = "<data>")]
async fn unarchive_cipher_selected(
data: Json<CipherIdsData>,
headers: Headers,
conn: DbConn,
nt: Notify<'_>,
) -> JsonResult {
_set_archived_multiple_ciphers(data, &headers, false, &conn, &nt).await
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok, but i would like to not use an _ as function prefix. I know we currently have this on several locations, but it's not really idomatic Rust since functions or variables starting with _ are normally used for functions or variables not really used, or need to be ignored during clippy lints.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@matt-aaron matt-aaron requested a review from BlackDex March 9, 2026 12:20
src/config.rs Outdated
"anon-addy-self-host-alias",
"simple-login-self-host-alias",
"mutual-tls",
"pm-19148-innovation-archive",
Copy link
Contributor

@stefan0xC stefan0xC Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BlackDex I have not tested it (and I am not sure how stable this feature is yet) but could we not just enable this feature directly instead of adding a new feature flag that you have to opt in?

Also the feature flags we set have already been removed for a few releases, so they can be safely replaced in my opinion.

feature_states.insert("duo-redirect".to_string(), true);
feature_states.insert("email-verification".to_string(), true);
feature_states.insert("unauth-ui-refresh".to_string(), true);
feature_states.insert("enable-pm-flight-recorder".to_string(), true);
feature_states.insert("mobile-error-reporting".to_string(), true);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With it being included in the 2026.2.1 release announcement, I think it'd be stable enough to enable directly

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have enabled the flag directly and removed some of the older flags (keeping email-verification and mobile-error-reporting).

@BlackDex Let me know if this needs further adjustments

@qianlongzt
Copy link

I’m just wondering why we don’t simply add a field to the ciphers table.

https://github.com/bitwarden/server/blob/main/src/Sql/dbo/Vault/Tables/Cipher.sql#L16
ref: bitwarden/server#6578

@matt-aaron
Copy link
Author

matt-aaron commented Mar 9, 2026

I’m just wondering why we don’t simply add a field to the ciphers table.

https://github.com/bitwarden/server/blob/main/src/Sql/dbo/Vault/Tables/Cipher.sql#L16 ref: bitwarden/server#6578

They originally did that, but later added the archives column to that table. This enables users the archives to be per-user instead of impacting other users within an org, for example.

@matt-aaron matt-aaron force-pushed the archiving branch 2 times, most recently from f5497c3 to 4bfc0b2 Compare March 9, 2026 18:03
@matt-aaron
Copy link
Author

Refactored to properly support importing items that were archived

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants