Skip to content

improvement(files): enhance file sharing - #6983

Merged
j15z merged 1 commit into
stagingfrom
feat/enhance-file-sharing-modal
Aug 22, 2026
Merged

improvement(files): enhance file sharing#6983
j15z merged 1 commit into
stagingfrom
feat/enhance-file-sharing-modal

Conversation

@j15z

@j15z j15z commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • keep the share modal open while creating, updating, or removing a file share
  • add private workspace link copying to file actions with toast feedback
  • confirm unsharing and preserve share links across access-mode updates

Type of Change

  • Improvement

Testing

  • bun run lint
  • bun run apps/sim/scripts/check-block-registry.ts origin/staging
  • bun run check:audits
  • bun run type-check from apps/sim
  • focused file-sharing modal tests (11 passing)

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 22, 2026 7:48pm

Request Review

@cursor

cursor Bot commented Aug 22, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches public file-sharing UX and when share state is read/invalidated, so incorrect gating or stale share data could leak or revoke access incorrectly. Backend auth contracts are unchanged.

Overview
Reworks file sharing so the modal stays open after share, update, or unshare, with explicit Share / Update / Unshare actions, toasts, and a confirmation before unsharing. Public share links are shown only after a share exists and stay available while changing access mode.

Adds Copy Link for the private workspace file URL from the file viewer and row context menu (separate from public Share). Share reads always refetch on modal open, and file-list invalidation now runs after the mutation settles. Includes a focused ShareModal test suite.

Reviewed by Cursor Bugbot for commit a0d9254. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR keeps file-sharing dialogs open during mutations, adds confirmation and toast feedback, preserves durable share links across access-mode changes, and adds private workspace-file link copying.

  • Refactors the share modal around explicit Share, Update, and Unshare actions.
  • Adds an authoritative share refetch on modal mount and updates React Query cache invalidation.
  • Adds Copy Link actions to file context menus and the open-file action menu.
  • Adds focused tests for sharing modes, policy restrictions, pending behavior, and unsharing.

Confidence Score: 4/5

The PR appears safe to merge, with one non-blocking interaction issue while authoritative sharing settings are loading.

The sharing and link-copying flows remain functional, but access controls can accept edits against stale initial data and then change their effective action when the authoritative record arrives.

Files Needing Attention: apps/sim/app/workspace/[workspaceId]/files/components/share-modal/share-modal.tsx

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/files/components/share-modal/share-modal.tsx Reworks sharing state and actions comprehensively, but permits draft edits before the authoritative post-mount read completes.
apps/sim/app/workspace/[workspaceId]/files/files.tsx Adds correctly targeted private file-link copying to context and viewer actions.
apps/sim/hooks/queries/public-shares.ts Forces authoritative modal refetches and invalidates workspace lists after both successful and failed mutations.
apps/sim/app/workspace/[workspaceId]/files/components/share-modal/share-modal.test.tsx Provides broad coverage of the revised sharing workflow but does not exercise user edits during the authoritative-read window.
apps/sim/app/workspace/[workspaceId]/files/components/file-row-context-menu/file-row-context-menu.tsx Adds a single-file Copy Link action and distinguishes its icon from public sharing.
apps/sim/lib/api/contracts/public-shares.ts Updates documentation for the existing client-reserved token contract without changing its validation.

Sequence Diagram

sequenceDiagram
  participant U as User
  participant M as Share modal
  participant Q as Share query
  participant API as Share API
  U->>M: Open file sharing
  M->>Q: Refetch authoritative share
  Q->>API: GET current share
  API-->>Q: Active, inactive, or null share
  Q-->>M: Reconcile saved configuration
  U->>M: Share, update, or confirm unshare
  M->>API: PUT sharing configuration
  API-->>M: Durable share record
  M->>Q: Update detail cache
  M-->>U: Keep modal open and show feedback
Loading

Reviews (1): Last reviewed commit: "improvement(files): enhance file sharing" | Re-trigger Greptile

Comment on lines +208 to +212
<ButtonGroup
value={effectiveMode}
onValueChange={(value) => setDraftMode(value as ShareAuthType)}
aria-label='File access'
disabled={upsertShare.isPending}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Editable pre-fetch sharing state

Before the authoritative share read completes, the access controls accept edits against stale initial data. When the saved record arrives, it rebases those edits and can change the primary action from Update to the destructive Unshare flow, making the modal's action change underneath the user.

@j15z
j15z merged commit fb8f0d6 into staging Aug 22, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/enhance-file-sharing-modal branch August 24, 2026 07:53
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