Skip to content

Commit dfb7b55

Browse files
committed
removed confirm prompt if you are editing someone else's project and then do file -> upload
1 parent 6e33508 commit dfb7b55

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/containers/sb-file-uploader.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import sharedMessages from '../lib/shared-messages';
1010
import {
1111
LoadingStates,
1212
getIsLoadingUpload,
13+
getIsShowingWithoutId,
1314
onLoadedProject,
1415
requestProjectUpload
1516
} from '../reducers/project-state';
@@ -91,6 +92,7 @@ class SBFileUploader extends React.Component {
9192
handleChange (e) {
9293
const {
9394
intl,
95+
isShowingWithoutId,
9496
loadingState,
9597
projectChanged,
9698
userOwnsProject
@@ -104,7 +106,7 @@ class SBFileUploader extends React.Component {
104106
// we must confirm with the user that they really intend to replace it.
105107
// (If they don't own the project and haven't changed it, no need to confirm.)
106108
let uploadAllowed = true;
107-
if (userOwnsProject || projectChanged) {
109+
if (userOwnsProject || (projectChanged && isShowingWithoutId)) {
108110
uploadAllowed = confirm( // eslint-disable-line no-alert
109111
intl.formatMessage(sharedMessages.replaceProjectWarning)
110112
);
@@ -172,6 +174,7 @@ SBFileUploader.propTypes = {
172174
closeFileMenu: PropTypes.func,
173175
intl: intlShape.isRequired,
174176
isLoadingUpload: PropTypes.bool,
177+
isShowingWithoutId: PropTypes.bool,
175178
loadingState: PropTypes.oneOf(LoadingStates),
176179
onLoadingFinished: PropTypes.func,
177180
onLoadingStarted: PropTypes.func,
@@ -190,6 +193,7 @@ const mapStateToProps = state => {
190193
const loadingState = state.scratchGui.projectState.loadingState;
191194
return {
192195
isLoadingUpload: getIsLoadingUpload(loadingState),
196+
isShowingWithoutId: getIsShowingWithoutId(loadingState),
193197
loadingState: loadingState,
194198
projectChanged: state.scratchGui.projectChanged,
195199
vm: state.scratchGui.vm

0 commit comments

Comments
 (0)