-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fixed/ Logged out error modal. #3054
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3042a77
ut
letscodedanish 9fc3d6f
Fixed Logged out error modal
letscodedanish 31847a4
final commit
letscodedanish 4c5557a
Merge branch 'develop' into fix/modal
letscodedanish dc4c7b5
suggested changes done
letscodedanish 037ecfc
Merge branch 'fix/modal' of https://github.com/letscodedanish/p5.js-w…
letscodedanish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you've got the
if
checking a little bit backwards here. We want to allow downloading of other people's projects. But we do not want to call save functions on other people's projects.Should be more like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lindapaiste ,I've revised the downloadSketch function to ensure that we only trigger the autosave functionality if the user is authenticated and they are the owner of the sketch. Here's the updated implementation:
function downloadSketch() {
if (authenticated && project.owner === authenticated.userId) {
dispatch(autosaveProject());
}
exportProjectAsZip(project.id);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lindapaiste , And I think this could also be done , correct me if I'm wrong
if (authenticated && project.owner === authenticated.userId) {
dispatch(autosaveProject());
exportProjectAsZip(project.id);
} else {
exportProjectAsZip(project.id);
}
This code block first checks if the user is authenticated and if the current user is the owner of the project. If both conditions are met, it triggers the autosaveProject function before exporting the project as a zip file. If the conditions are not met, it directly exports the project as a zip file without triggering the autosave function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should run your code locally and make sure that it works before submitting a PR.
authenticated.userId
will not work becauseauthenticated
is aboolean
value -- it is not the user object.project.owner
is not the id -- it's the entire user object for the owner. We need a different conditional check here. Probablyauthenticated && canEditProjectName
would do it? But we need to try it out and check the various situations, like if this is a new sketch that has not been saved before.