Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logged out error modal pops up when downloading another user's sketch #3053

Closed
lindapaiste opened this issue Feb 26, 2024 · 1 comment · Fixed by #3116
Closed

Logged out error modal pops up when downloading another user's sketch #3053

lindapaiste opened this issue Feb 26, 2024 · 1 comment · Fixed by #3116
Labels

Comments

@lindapaiste
Copy link
Collaborator

lindapaiste commented Feb 26, 2024

p5.js version

No response

What is your operating system?

None

Web browser and version

No response

Actual Behavior

image

Expected Behavior

I should be able to download p5's sketch without any error.

The sketch actually does export successfully, using the saved version of the project.

We are getting this message because we make a PUT request to the API before exporting a sketch. That API request will fail if the user is not the owner of the sketch. The easiest solution would be to only make that API call if there is a logged in user and that user is the owner of the sketch.

The relevant code is here:

function downloadSketch() {
dispatch(autosaveProject());
exportProjectAsZip(project.id);
}

There is some nuance here with regards to how we would handle local/unsaved changes. Right now those changes would not be applied if it is not your sketch. This is part of a larger discussion happening in #2904.

Steps to reproduce

Steps:

  1. Make sure that you are logged out
  2. Go to a sketch which is not your own, such as https://editor.p5js.org/p5/sketches/Data:_True_and_False
  3. Click the "File" menu
  4. Click "Download"
@vivekbopaliya
Copy link
Contributor

I haven't looked into the issue yet but why are we calling autoSaveProject before downloading? It doesn't seem necessary to save someone's project before downloading it i think so. Removing that step should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment