feat(desktop): leave communities through relay - #3621
Draft
tellaho wants to merge 2 commits into
Draft
Conversation
Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Category: improvement
User Impact: People can leave their final Buzz community and return to Join or create a community without losing their signed-in identity.
Problem: Buzz Desktop blocked people from leaving when only one community remained. Its existing remove action also changed local configuration without ending relay membership.
Solution: Allow the final community to be left. Buzz now asks the relay to end membership, removes the community locally only after acceptance, and returns the person to the community selector while keeping their identity signed in. If other communities remain, Buzz switches to one of them. Relay rejection or timeout keeps the community in place and shows an actionable retry error.
File changes
desktop/src/features/communities/leaveCommunity.ts
Adds signed kind 28936 publishing for active and inactive community relays with actionable timeout handling.
desktop/src/features/communities/leaveCommunity.test.mjs
Covers event shape, relay selection, acceptance gating, rejection, timeout messaging, and cleanup.
desktop/src/features/communities/useCommunities.tsx
Allows final-community removal and clears community-specific storage without touching identity.
desktop/src/features/communities/resolveCommunityRemoval.test.mjs
Covers final, active, and inactive community removal state transitions.
desktop/src/app/useCommunityNavigationTransitions.ts
Gates local removal on relay acceptance and routes to a fallback community or setup selector.
desktop/src/app/AppShell.tsx
Passes the asynchronous leave operation through shell entry points.
desktop/src/features/communities/ui/EditCommunityDialog.tsx
Replaces the local-only remove action with a pending-aware Leave Community action that retains actionable errors.
desktop/src/features/communities/ui/CommunitySwitcher.tsx
Enables leaving the final community and carries the asynchronous callback.
desktop/src/features/sidebar/ui/AppSidebar.tsx
Carries the asynchronous leave callback through sidebar props.
desktop/src/features/sidebar/ui/CommunityRail.tsx
Enables leaving the final community from rail settings.
desktop/src/features/sidebar/ui/SidebarProfileCard.tsx
Carries the asynchronous leave callback through profile community settings.
desktop/src/testing/e2eBridge.ts
Teaches the mock relay to accept NIP-43 leave events.
desktop/tests/e2e/community-rail.spec.ts
Updates leave interactions and verifies final-community setup navigation, storage cleanup, and identity preservation.
Reproduction steps
OKresponse and confirm the community remains configured with an actionable error in the dialog.Test plan
pnpm checkpnpm buildpnpm test(3,782 passing)pnpm build:e2e && pnpm exec playwright test tests/e2e/community-rail.spec.ts --grep "final community"