@@ -10,6 +10,7 @@ import sharedMessages from '../lib/shared-messages';
10
10
import {
11
11
LoadingStates ,
12
12
getIsLoadingUpload ,
13
+ getIsShowingWithoutId ,
13
14
onLoadedProject ,
14
15
requestProjectUpload
15
16
} from '../reducers/project-state' ;
@@ -91,6 +92,7 @@ class SBFileUploader extends React.Component {
91
92
handleChange ( e ) {
92
93
const {
93
94
intl,
95
+ isShowingWithoutId,
94
96
loadingState,
95
97
projectChanged,
96
98
userOwnsProject
@@ -104,7 +106,7 @@ class SBFileUploader extends React.Component {
104
106
// we must confirm with the user that they really intend to replace it.
105
107
// (If they don't own the project and haven't changed it, no need to confirm.)
106
108
let uploadAllowed = true ;
107
- if ( userOwnsProject || projectChanged ) {
109
+ if ( userOwnsProject || ( projectChanged && isShowingWithoutId ) ) {
108
110
uploadAllowed = confirm ( // eslint-disable-line no-alert
109
111
intl . formatMessage ( sharedMessages . replaceProjectWarning )
110
112
) ;
@@ -172,6 +174,7 @@ SBFileUploader.propTypes = {
172
174
closeFileMenu : PropTypes . func ,
173
175
intl : intlShape . isRequired ,
174
176
isLoadingUpload : PropTypes . bool ,
177
+ isShowingWithoutId : PropTypes . bool ,
175
178
loadingState : PropTypes . oneOf ( LoadingStates ) ,
176
179
onLoadingFinished : PropTypes . func ,
177
180
onLoadingStarted : PropTypes . func ,
@@ -190,6 +193,7 @@ const mapStateToProps = state => {
190
193
const loadingState = state . scratchGui . projectState . loadingState ;
191
194
return {
192
195
isLoadingUpload : getIsLoadingUpload ( loadingState ) ,
196
+ isShowingWithoutId : getIsShowingWithoutId ( loadingState ) ,
193
197
loadingState : loadingState ,
194
198
projectChanged : state . scratchGui . projectChanged ,
195
199
vm : state . scratchGui . vm
0 commit comments