Skip migration if it's not needed

pull/1/head
yflory 3 years ago
parent 60821d8c0c
commit 045cb86f3e

@ -2858,19 +2858,28 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
} }
} else if (content && content.version <= 4) { // V2 or V3 } else if (content && content.version <= 4) { // V2 or V3
version = content.version <= 3 ? 'v2b/' : 'v4/'; version = content.version <= 3 ? 'v2b/' : 'v4/';
APP.migrate = true; var skip = false;
// Registedred ~~users~~ editors can start the migration if (content.version === 4 && NEW_VERSION === 5) {
if (common.isLoggedIn() && !readOnly) { // Skip if there is no chart in the document
content.migration = true; skip = !getEditor().GetDocument().GetAllCharts().length;
APP.onLocal(); }
if (skip) {
content.version = NEW_VERSION;
} else { } else {
msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor); APP.migrate = true;
if (APP.helpMenu) { // Registedred ~~users~~ editors can start the migration
$(APP.helpMenu.menu).after(msg); if (common.isLoggedIn() && !readOnly) {
content.migration = true;
APP.onLocal();
} else { } else {
$('#cp-app-oo-editor').prepend(msg); msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor);
if (APP.helpMenu) {
$(APP.helpMenu.menu).after(msg);
} else {
$('#cp-app-oo-editor').prepend(msg);
}
readOnly = true;
} }
readOnly = true;
} }
} }
// NOTE: don't forget to also update the version in 'EV_OOIFRAME_REFRESH' // NOTE: don't forget to also update the version in 'EV_OOIFRAME_REFRESH'

Loading…
Cancel
Save