diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-07 16:57:28 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-07 16:57:28 +0800 |
| commit | f97ad6f00c4d526b710171cf611bd582f6f9f8ac (patch) | |
| tree | d8e8f557bb4fcd4edbebe5911d5b613e32312bb7 /crates | |
| parent | b4661072366c4dcc63e914f2ec8625ad73b14645 (diff) | |
Extract holder assignment for reuse in sheet creation
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/vcs_actions/src/actions/sheet_actions.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/vcs_actions/src/actions/sheet_actions.rs b/crates/vcs_actions/src/actions/sheet_actions.rs index 7c63a2f..4c9977e 100644 --- a/crates/vcs_actions/src/actions/sheet_actions.rs +++ b/crates/vcs_actions/src/actions/sheet_actions.rs @@ -53,16 +53,17 @@ pub async fn make_sheet_action( if ctx.is_proc_on_remote() { let vault = try_get_vault(&ctx)?; + let holder = if is_host_mode { + VAULT_HOST_NAME.to_string() + } else { + member_id + }; // Check if the sheet already exists if let Ok(mut sheet) = vault.sheet(&sheet_name).await { // If the sheet has no holder, assign it to the current member (restore operation) if sheet.holder().is_none() { - sheet.set_holder(if is_host_mode { - VAULT_HOST_NAME.to_string() - } else { - member_id - }); + sheet.set_holder(holder.clone()); match sheet.persist().await { Ok(_) => { write_and_return!(instance, MakeSheetActionResult::SuccessRestore); @@ -79,7 +80,7 @@ pub async fn make_sheet_action( } } else { // Create the sheet - match vault.create_sheet(&sheet_name, &member_id).await { + match vault.create_sheet(&sheet_name, &holder).await { Ok(_) => { write_and_return!(instance, MakeSheetActionResult::Success); } |
