fix(archive): atomic remove-kind path + split test modules (#1562)

Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Co-authored-by: npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
Will Pfleger
2026-07-06 18:45:05 -04:00
committed by GitHub
co-authored by npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw
parent 429f54b4f4
commit 484bede759
8 changed files with 2082 additions and 1930 deletions
+18
View File
@@ -126,6 +126,24 @@ export async function mergeSaveSubscriptionKinds(kind: number): Promise<void> {
notifySubscriptionChange();
}
/**
* Atomically remove `kind` from the `owner_p` save subscription for the
* current identity + relay.
*
* Mirrors `mergeSaveSubscriptionKinds`: reads existing kinds, removes `kind`,
* then deletes the row if the list becomes empty or updates it otherwise.
* Uses `BEGIN IMMEDIATE` on the Rust side for the same reason as the merge
* path — concurrent toggle-OFF callers serialize rather than racing.
*
* Called by toggle-OFF handlers in `LocalArchiveSettingsCard` for both
* kind 24200 and kind 44200, replacing the former TS-side read-modify-overwrite
* that would drop the *other* kind if `subs` state was stale.
*/
export async function removeSaveSubscriptionKind(kind: number): Promise<void> {
await invokeTauri("remove_save_subscription_kind", { kind });
notifySubscriptionChange();
}
/**
* Create a save subscription.
* Runs an access probe on the backend (channel membership, event readability).