Skip to content

Comments

feat: allow duplicate file outside context of "current" team#2281

Merged
jimniels merged 67 commits intoqafrom
duplicate-file
Apr 15, 2025
Merged

feat: allow duplicate file outside context of "current" team#2281
jimniels merged 67 commits intoqafrom
duplicate-file

Conversation

@jimniels
Copy link
Collaborator

@jimniels jimniels commented Feb 14, 2025

Allow users to duplicate files that are in teams they don't have access to.

Logged out users will see:

CleanShot 2025-02-19 at 17 11 29@2x

Logged in users will see:

CleanShot 2025-02-19 at 17 11 52@2x

When you duplicate a file from the sheet side of the app (or from one of the permission messages you see above), it will duplicate the file to your active team. If you have access to more than one team, it will route you to a page and ask where you want to duplicate the file.

CleanShot 2025-04-04 at 15 02 40@2x

Resolves #2252

Things to test

Duplicating a file

Notes on testing around this feature:

  • "Duplicate file" from the app will always duplicate the file to your private collection of team files ("My files").
  • If you can access the file, you can duplicate it. That includes:
    • File is on a team you belong to (as viewer or editor)
    • File was shared with you via public link (edit or view access)
    • You were invited to the file via email (viewer or editor)

As a logged in user:

  • Duplicate a file in a team you belong to
  • Duplicate a file in a team you DO NOT belong to

As a logged out user:

  • Duplicate a file in a team you belong to
  • Duplicate a file in a team you DO NOT belong to

As a new user:

  • Duplicate a file (into a new team that gets created when you sign up)

Ways to duplicate:

  • File menu: File -> Duplicate
  • Command palette: File -> Duplicate
  • Read-only file alert (logged in but can't edit a file)
  • Welcome to Quadratic file alert (not logged in)

Ensure that any connections in a file cannot be run (or their schema viewed) if the connections belong to another team. To test this, do the following:

  • Create a file, duplicate it to another team you belong to, then ensure that the connection cannot be run or viewed.
  • Create a file, share it with another Quadratic account, have that other account duplicate the file, then ensure that the connection cannot be run or viewed.

Routes

Note

This PR changes a lot of the routing, we should ensure all routes work as expected. This includes fixes to exisiting special handling for new users.

This includes URL routes for users coming to the app from the marketing site. We should make sure these work as expected for both existing users and new users after sign up.

Connection permissions

Note

This PR changed the server-side API in relation to connections, so that functionality should be tested

  • Create a connection
  • Update a connection
  • Delete a connection
  • Run a connection in a file

@qa-wolf
Copy link

qa-wolf bot commented Feb 14, 2025

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

@cla-bot cla-bot bot added the cla-signed label Feb 14, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Feb 14, 2025

Preview - Build & Deploy Images

✅ Build images
✅ Deploy images

🕒 Last deployed: Apr 15, 2025 at 05:58 PM UTC

🔗 URL: https://duplicate-file.quadratic-preview.com

@github-actions github-actions bot temporarily deployed to preview-pr-2281 February 14, 2025 23:39 Destroyed
@codecov
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 86.13861% with 14 lines in your changes missing coverage. Please review.

Project coverage is 90.59%. Comparing base (6162d2c) to head (1371032).
Report is 68 commits behind head on qa.

Files with missing lines Patch % Lines
quadratic-rust-shared/src/quadratic_api.rs 0.00% 4 Missing ⚠️
quadratic-connection/src/error.rs 0.00% 3 Missing ⚠️
quadratic-connection/src/connection.rs 0.00% 2 Missing ⚠️
quadratic-connection/src/sql/postgres.rs 89.47% 2 Missing ⚠️
quadratic-connection/src/sql/mssql.rs 94.44% 1 Missing ⚠️
quadratic-connection/src/sql/mysql.rs 94.44% 1 Missing ⚠️
quadratic-connection/src/sql/snowflake.rs 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               qa    #2281      +/-   ##
==========================================
- Coverage   90.59%   90.59%   -0.01%     
==========================================
  Files         397      397              
  Lines       88923    88998      +75     
==========================================
+ Hits        80564    80631      +67     
- Misses       8359     8367       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot temporarily deployed to preview-pr-2281 February 14, 2025 23:56 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2281 February 19, 2025 16:34 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2281 February 20, 2025 00:14 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2281 February 20, 2025 00:20 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2281 February 20, 2025 17:53 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2281 March 6, 2025 22:26 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2281 March 14, 2025 15:49 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2281 March 28, 2025 18:47 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2281 April 1, 2025 15:16 Destroyed
@jimniels jimniels self-assigned this Apr 1, 2025
@github-actions github-actions bot temporarily deployed to preview-pr-2281 April 4, 2025 14:45 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2281 April 15, 2025 10:30 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2281 April 15, 2025 10:41 Destroyed
Copy link
Contributor

@AyushAgrawal-A2 AyushAgrawal-A2 left a comment

Choose a reason for hiding this comment

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

2 changes requested in

  • getTeamConnection.test.ts (blocking) - #2281 (comment)
  • requireAuth (optional) - has redundant auth checks, will be great to have only one

@github-actions github-actions bot temporarily deployed to preview-pr-2281 April 15, 2025 15:26 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2281 April 15, 2025 15:38 Destroyed
@jimniels
Copy link
Collaborator Author

@AyushAgrawal-A2 great catches, I've resolved both of those. Ready for 👀 again.

@github-actions github-actions bot temporarily deployed to preview-pr-2281 April 15, 2025 17:32 Destroyed
Copy link
Contributor

@luke-quadratic luke-quadratic left a comment

Choose a reason for hiding this comment

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

Forgot to add approval when I went through this before - followed Jim's exhaustive list of testing

@github-actions github-actions bot temporarily deployed to preview-pr-2281 April 15, 2025 17:41 Destroyed
@jimniels jimniels merged commit 2e00f37 into qa Apr 15, 2025
23 of 24 checks passed
@jimniels jimniels deleted the duplicate-file branch April 15, 2025 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add an option Share Readonly, Allow Duplicate (for content creators / marketing)

5 participants