-
Notifications
You must be signed in to change notification settings - Fork 4k
upload in current project id, rather than creating new project id #4700
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
upload in current project id, rather than creating new project id #4700
Conversation
84f09bf to
a4e3683
Compare
|
Current status of this PR:
|
a4e3683 to
3ad8516
Compare
|
We are going to use javascript native confirm for now, rather than the new custom confirm. |
3ad8516 to
d13f07e
Compare
d13f07e to
c064eae
Compare
| } | ||
| id="gui.menuBar.uploadFromComputer" | ||
| /> | ||
| {this.props.intl.formatMessage(sharedMessages.loadFromComputerTitle)} |
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.
This message seems to me to make more sense living in a shared file than cluttering the render content of menu-bar
| sessionExists: state.session && typeof state.session.session !== 'undefined', | ||
| username: user ? user.username : null, | ||
| userOwnsProject: ownProps.authorUsername && user && | ||
| (ownProps.authorUsername === user.username), |
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 believe we discussed creating this prop -- it makes for cleaner separation of props logic and component display logic.
| // If user owns the project, or user has changed the project, | ||
| // we must confirm with the user that they really intend to replace it. | ||
| // (If they don't own the project and haven't changed it, no need to confirm.) | ||
| let uploadAllowed = true; |
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 tried to go for legibility here. It's not the most concise code, but I hope this will minimize the chance that the logic will be misunderstood.
| const DONE_REMIXING = 'scratch-gui/project-state/DONE_REMIXING'; | ||
| const DONE_UPDATING = 'scratch-gui/project-state/DONE_UPDATING'; | ||
| const DONE_UPDATING_BEFORE_COPY = 'scratch-gui/project-state/DONE_UPDATING_BEFORE_COPY'; | ||
| const DONE_UPDATING_BEFORE_FILE_UPLOAD = 'scratch-gui/project-state/DONE_UPDATING_BEFORE_FILE_UPLOAD'; |
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.
All of the changes to project-state are related to removing the "update (AKA save) project before uploading file" step, since we're no longer keeping around any changes to the current project.
| 'contains(@class, "menu-bar_hoverable")][span[text()="File"]]' | ||
| ); | ||
| await findByXpath('//*[li[span[text()="Load from your computer"]] and not(@data-tip="tooltip")]'); | ||
| await findByXpath('//*[li[text()="Load from your computer"] and not(@data-tip="tooltip")]'); |
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.
Since the message is in a shared file now, there's one less span
paulkaplan
left a comment
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.
Code changes look good to me.

Resolves
Proposed Changes
project-state.jsthat will no longer be usedStill needs work
confirm()with a custom modalNote
The new confirm logic will not confirm if you do the following:
The reason is that you haven't made any alterations to Project A; it's as if you just clicked see inside on a project, and then uploaded on top of that.
Replacing the project keeps the extensions open that the previous project was using. This issue is filed in Extensions should unload if you change projects scratch-vm#1731 and we do not plan on fixing it as part of this change.
Test Coverage
Revised
test/unit/reducers/project-state-reducer.test.jsto reflect changesBrowser Coverage
Check the OS/browser combinations tested (At least 2)
Mac
Windows
Chromebook
iPad
Android Tablet