Skip to content

Add Collaboration view: roster + member management (#240) - #1474

Merged
mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:feature/issue-240-collaboration-view
Jul 2, 2026
Merged

mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:feature/issue-240-collaboration-view

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Slice S3 of the collection-membership-UI epic (NodeSpaceAI/nodespace-sync#237) — the first membership UI surface.

Stacked on #1473 (S1). Cross-fork PRs must base on main, so this PR's diff includes the S1 commit until #1473 merges — review the top commit (Add Collaboration view…). I'll rebase onto main once #1473 lands.

What

Adds a Pro-only Collaboration tab to collection-node-viewer.svelte. The community build is unchanged — the tab strip only appears when proSync.tier === 'pro'; otherwise the existing Contents view renders exactly as before.

The Collaboration tab renders the people roster (via S1's membership store):

  • Each member's role badge; the caller's own row is marked "(you)".
  • Admin controls (gated on the caller's own role === 'admin'):
    • change a member's role — Viewer / Editor / Admin select → pro_set_member
    • remove a member — inline confirm → pro_remove_member, with the last-admin protection surfaced as a friendly message
    • add someone already in the workspace by person id → pro_set_member
  • Leave (self) → pro_leave_collection.
  • Non-admins see a read-only roster (no selects, no add form).

Notes

  • The "add existing person" input takes a raw person id for now; a proper autocomplete over locally-synced person nodes is a follow-up once a persons-listing source exists — invites (S4, Move system tray ownership to nodespaced daemon #241) are the primary path for bringing in new people.
  • Role display currently shows the person id (membership.displayFor); resolving to a name/email from local person nodes is wired in a follow-up (email visibility is can_see_person-gated server-side).

Tests

  • 5 component tests (@testing-library/svelte): admin vs non-admin gating, community-inert render, role-change wiring, load-on-mount. Full membership suite (S1 + S3) green — 21 tests.
  • bun run quality:fix — ESLint 0/0, svelte-check 0 errors.

Depends on S1 (#238 / #1473). Part of #240.

@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE

Reviewed the top S3 commit fb1d39c9 only (stacked on #1473; the S1 files belong there). Confirmed the top commit touches only the 3 S3 files and modifies no S1 file.

  • 🟢 Community build unchanged — verified. The one community-facing file, collection-node-viewer.svelte, is +49/-0 (zero deletions): the tab strip is wrapped in {#if proSync.isPro} and the body in {#if proSync.isPro && activeView === 'collaboration'} with an {:else} that renders the pre-existing, untouched .collection-content. In community mode: no tab strip, Contents only — byte-identical to before. proSync.isPro is $derived(tier === 'pro') (pro-sync.svelte.ts:78); the view double-gates (collaboration-view.svelte:212).
  • 🟢 Admin controls gate on the caller's OWN role — myRole = membership.currentUserRole(collectionId) / amAdmin (collaboration-view.svelte:63-64), where currentUserRole matches currentPerson.personId against the roster; change-role/Remove are {#if amAdmin && !isSelf} (:236), add/invites/requests {#if amAdmin} (:273). Not the target's role.
  • 🟢 Last-admin protection surfaced, server-authoritative — friendly() (:67-74) maps the daemon's FAILED_PRECONDITION to a readable message with a raw-error fallback; UI gating is visibility-only, all mutations route through the store→pro_* commands→daemon/cloud, so a UI bypass is still blocked server-side.

🟡 Non-blocking:

  • The header comment (:8-10) says invites & join requests live in a "sibling InvitesPanel (S4)", but this file implements the full S4 invite/request management inline (:296-394). Reconcile — fix the comment or split S4 out per the epic slicing.
  • Tests cover community-inert render + admin/non-admin gating + role-change wiring + load-on-mount, but not the last-admin friendly() message nor the invite/request paths now in the component — worth at least a last-admin-message test.

🔶 Stacked-base: this is stacked on #1473 (S1); its diff currently includes S1 commit 90efb7c3. Retarget/rebase onto main once #1473 lands so the diff shows only S3 — and #1473 has an open REQUEST CHANGES from me, so this shouldn't merge ahead of it.

Slice S3 — the first membership UI surface, on top of S1's store. Adds a
Pro-only "Collaboration" tab to the collection viewer (community sees the
existing Contents view unchanged) that renders the people roster:

- Roster with each member's role badge; the caller's own row is marked "(you)".
- Admin controls (gated on the caller's own role === 'admin'): change a
  member's role (Viewer/Editor/Admin select → pro_set_member), remove a member
  (inline confirm → pro_remove_member) with the last-admin protection surfaced
  as a friendly message, and add someone already in the workspace by person id.
- Self-service Leave (pro_leave_collection).
- Non-admins see a read-only roster (no selects, no add form).

The add-existing-person input takes a raw person id for now; a proper
autocomplete over locally-synced person nodes is a follow-up once a persons
source exists — invites (S4) are the primary path for bringing in new people.

Tests: 5 component tests (admin vs non-admin gating, community-inert render,
role-change wiring, load-on-mount).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125
mstomar125 merged commit 5f419e1 into NodeSpaceAI:main Jul 2, 2026
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