Skip to content

Commit

Permalink
Fix updating file: check onOutdatedVersion event
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Dec 24, 2024
1 parent a960cc2 commit ee845ae
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 11 deletions.
1 change: 1 addition & 0 deletions apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@
_config.editorConfig.canSaveDocumentToBinary = _config.events && !!_config.events.onSaveDocument;
_config.editorConfig.canStartFilling = _config.events && !!_config.events.onRequestStartFilling;
_config.editorConfig.canRequestRefreshFile = _config.events && !!_config.events.onRequestRefreshFile;
_config.editorConfig.canUpdateVersion = _config.events && !!_config.events.onOutdatedVersion;
_config.frameEditorId = placeholderId;
_config.parentOrigin = window.location.origin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CommentsController extends Component {
/** coauthoring end **/
}

this.curUserId = this.props.users.currentUser.asc_getIdOriginal();
this.curUserId = this.props.users.currentUser ? this.props.users.currentUser.asc_getIdOriginal() : '';
});
}
onApiActiveSheetChanged (index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,10 +785,11 @@ define([
_.defer(function() {
Common.Gateway.updateVersion();
if (callback) callback.call(me);
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
me.editorConfig && me.editorConfig.canUpdateVersion && me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
})
}
});
Common.NotificationCenter.trigger('api:disconnect');
},

onLicenseChanged: function(params) {
Expand Down
2 changes: 1 addition & 1 deletion apps/documenteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2594,7 +2594,7 @@ define([
_.defer(function() {
Common.Gateway.updateVersion();
if (callback) callback.call(me);
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
me.editorConfig && me.editorConfig.canUpdateVersion && me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
})
}});
this.disableEditing(true, 'not-loaded');
Expand Down
4 changes: 3 additions & 1 deletion apps/documenteditor/mobile/src/controller/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,7 @@ class MainController extends Component {

this.needToUpdateVersion = true;
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], Asc.c_oAscAsyncAction['Open']);

f7.dialog.alert(
_t.errorUpdateVersion,
Expand All @@ -1371,8 +1372,9 @@ class MainController extends Component {
if (callback) {
callback.call(this);
}
Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
this.editorConfig && this.editorConfig.canUpdateVersion && Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
});
Common.Notifications.trigger('api:disconnect');
}

onDocumentName () {
Expand Down
2 changes: 1 addition & 1 deletion apps/pdfeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,7 @@ define([
_.defer(function() {
Common.Gateway.updateVersion();
if (callback) callback.call(me);
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
me.editorConfig && me.editorConfig.canUpdateVersion && me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
})
}
});
Expand Down
2 changes: 1 addition & 1 deletion apps/presentationeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,7 @@ define([
_.defer(function() {
Common.Gateway.updateVersion();
if (callback) callback.call(me);
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
me.editorConfig && me.editorConfig.canUpdateVersion && me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
})
}
});
Expand Down
4 changes: 3 additions & 1 deletion apps/presentationeditor/mobile/src/controller/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ class MainController extends Component {

this.needToUpdateVersion = true;
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], Asc.c_oAscAsyncAction['Open']);

f7.dialog.alert(
_t.errorUpdateVersion,
Expand All @@ -774,8 +775,9 @@ class MainController extends Component {
if (callback) {
callback.call(this);
}
Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
this.editorConfig && this.editorConfig.canUpdateVersion && Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
});
Common.Notifications.trigger('api:disconnect');
}

onServerVersion (buildVersion) {
Expand Down
2 changes: 1 addition & 1 deletion apps/spreadsheeteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2519,7 +2519,7 @@ define([
_.defer(function() {
Common.Gateway.updateVersion();
if (callback) callback.call(me);
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
me.editorConfig && me.editorConfig.canUpdateVersion && me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
})
}
});
Expand Down
4 changes: 3 additions & 1 deletion apps/spreadsheeteditor/mobile/src/controller/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,7 @@ class MainController extends Component {

this.needToUpdateVersion = true;
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], Asc.c_oAscAsyncAction['Open']);

f7.dialog.alert(
_t.errorUpdateVersion,
Expand All @@ -1129,8 +1130,9 @@ class MainController extends Component {
if (callback) {
callback.call(this);
}
Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
this.editorConfig && this.editorConfig.canUpdateVersion && Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
});
Common.Notifications.trigger('api:disconnect');
}

onServerVersion (buildVersion) {
Expand Down
2 changes: 1 addition & 1 deletion apps/visioeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,7 @@ define([
_.defer(function() {
Common.Gateway.updateVersion();
if (callback) callback.call(me);
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
me.editorConfig && me.editorConfig.canUpdateVersion && me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
})
}
});
Expand Down
4 changes: 3 additions & 1 deletion apps/visioeditor/mobile/src/controller/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ class MainController extends Component {

this.needToUpdateVersion = true;
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], Asc.c_oAscAsyncAction['Open']);

f7.dialog.alert(
_t.errorUpdateVersion,
Expand All @@ -536,8 +537,9 @@ class MainController extends Component {
if (callback) {
callback.call(this);
}
Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
this.editorConfig && this.editorConfig.canUpdateVersion && Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
});
Common.Notifications.trigger('api:disconnect');
}

onServerVersion (buildVersion) {
Expand Down

0 comments on commit ee845ae

Please sign in to comment.