Skip to content

feat(desktop): leave communities through relay - #3621

Draft
tellaho wants to merge 2 commits into
mainfrom
tho/leave-community
Draft

feat(desktop): leave communities through relay#3621
tellaho wants to merge 2 commits into
mainfrom
tho/leave-community

Conversation

@tellaho

@tellaho tellaho commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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

  1. Run Buzz Desktop with a signed-in identity and one joined community.
  2. Open Community settings and choose Leave Community.
  3. Confirm the app shows Join or create a community and the existing identity remains signed in.
  4. Repeat with two communities and confirm leaving the active one switches cleanly to the remaining community.
  5. Reject or withhold the relay OK response and confirm the community remains configured with an actionable error in the dialog.

Test plan

  • pnpm check
  • pnpm build
  • pnpm test (3,782 passing)
  • pnpm build:e2e && pnpm exec playwright test tests/e2e/community-rail.spec.ts --grep "final community"

npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w and others added 2 commits July 29, 2026 14:06
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>
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.

1 participant