diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index afa7cefea..9d338ffd9 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1085,7 +1085,7 @@ define([ this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory; this.appOptions.canUseMailMerge= this.appOptions.canLicense && this.appOptions.canEdit && !this.appOptions.isOffline; this.appOptions.canSendEmailAddresses = this.appOptions.canLicense && this.editorConfig.canSendEmailAddresses && this.appOptions.canEdit && this.appOptions.canCoAuthoring; - this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comment===undefined ? this.appOptions.isEdit : this.permissions.comment); + this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comment===undefined ? this.appOptions.isEdit : this.permissions.comment) && (this.editorConfig.mode !== 'view'); this.appOptions.canComments = this.appOptions.canComments && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit; @@ -1101,7 +1101,7 @@ define([ this.appOptions.canProtect = (this.appOptions.isSignatureSupport || this.appOptions.isPasswordSupport); this.appOptions.canEditContentControl = (this.permissions.modifyContentControl!==false); this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); - this.appOptions.canFillForms = (this.permissions.fillForms===undefined) ? this.appOptions.isEdit : this.permissions.fillForms; + this.appOptions.canFillForms = ((this.permissions.fillForms===undefined) ? this.appOptions.isEdit : this.permissions.fillForms) && (this.editorConfig.mode !== 'view'); this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && (this.appOptions.canComments || this.appOptions.canFillForms); if (this.appOptions.isRestrictedEdit && this.appOptions.canComments && this.appOptions.canFillForms) // must be one restricted mode, priority for filling forms this.appOptions.canComments = false; @@ -1141,8 +1141,8 @@ define([ } this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit); - (!this.appOptions.isEdit && this.appOptions.canComments) && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments); - (!this.appOptions.isEdit && this.appOptions.canFillForms) && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms); + this.appOptions.isRestrictedEdit && this.appOptions.canComments && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments); + this.appOptions.isRestrictedEdit && this.appOptions.canFillForms && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms); this.api.asc_LoadDocument(); }, diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 9f79fa8c0..0d07207b8 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -648,7 +648,7 @@ define([ } me._state.fastCoauth = (value===null || parseInt(value) == 1); } else { - me._state.fastCoauth = (!me.appOptions.isEdit && me.appOptions.canComments); + me._state.fastCoauth = (!me.appOptions.isEdit && me.appOptions.isRestrictedEdit); if (me._state.fastCoauth) { me.api.asc_setAutoSaveGap(1); Common.Utils.InternalSettings.set("pe-settings-autosave", 1); @@ -851,7 +851,7 @@ define([ this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; this.appOptions.canDownload = !this.appOptions.nativeApp && this.permissions.download !== false; this.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable(); - this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comment===undefined ? this.appOptions.isEdit : this.permissions.comment); + this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comment===undefined ? this.appOptions.isEdit : this.permissions.comment) && (this.editorConfig.mode !== 'view'); this.appOptions.canComments = this.appOptions.canComments && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canPrint = (this.permissions.print !== false); @@ -864,6 +864,7 @@ define([ this.appOptions.isPasswordSupport = this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isProtectionSupport(); this.appOptions.canProtect = (this.appOptions.isSignatureSupport || this.appOptions.isPasswordSupport); this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); + this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canComments; this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object'); if (this.appOptions.canBranding) @@ -885,8 +886,8 @@ define([ this.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); } - this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.canComments); - (!this.appOptions.isEdit && this.appOptions.canComments) && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments); + this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit); + (this.appOptions.isRestrictedEdit && this.appOptions.canComments) && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments); this.api.asc_LoadDocument(); }, diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 91bb228e0..1d7158447 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -628,7 +628,7 @@ define([ } this._state.fastCoauth = (value===null || parseInt(value) == 1); } else { - this._state.fastCoauth = (!this.appOptions.isEdit && this.appOptions.canComments); + this._state.fastCoauth = (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit); if (this._state.fastCoauth) { this.api.asc_setAutoSaveGap(1); Common.Utils.InternalSettings.set("sse-settings-autosave", 1); @@ -874,7 +874,7 @@ define([ /** coauthoring begin **/ this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion; /** coauthoring end **/ - this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comment===undefined ? (this.permissions.edit !== false && this.editorConfig.mode !== 'view') : this.permissions.comment); + this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comment===undefined ? (this.permissions.edit !== false) : this.permissions.comment) && (this.editorConfig.mode !== 'view'); this.appOptions.canComments = this.appOptions.canComments && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canRename = this.editorConfig.canRename && !!this.permissions.rename; @@ -903,6 +903,7 @@ define([ this.appOptions.isPasswordSupport = this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isProtectionSupport() && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge); this.appOptions.canProtect = (this.appOptions.isSignatureSupport || this.appOptions.isPasswordSupport); this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); + this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canComments; if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge) { this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); @@ -920,8 +921,8 @@ define([ this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); } - this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.canComments); - (!this.appOptions.isEdit && this.appOptions.canComments) && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments); + this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit); + (this.appOptions.isRestrictedEdit && this.appOptions.canComments) && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments); this.api.asc_LoadDocument(); },