From abb96ec86620254971ff87a3ac1471347e161f67 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 19 Nov 2021 22:41:44 +0300 Subject: [PATCH] Bug 53757: move chat to permisions. deprecate customization.chat parameter. --- apps/documenteditor/main/app/controller/Main.js | 6 +++++- apps/documenteditor/mobile/src/store/appOptions.js | 2 +- apps/presentationeditor/main/app/controller/Main.js | 6 +++++- apps/presentationeditor/mobile/src/store/appOptions.js | 2 +- apps/spreadsheeteditor/main/app/controller/Main.js | 6 +++++- apps/spreadsheeteditor/mobile/src/store/appOptions.js | 2 +- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index b49199539..65cdab73f 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1403,7 +1403,11 @@ define([ 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.canViewComments = 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.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !(this.permissions.chat===false || (this.permissions.chat===undefined) && + (typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); + if ((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat!==undefined) { + console.log("Obsolete: The 'chat' parameter of the 'customization' section is deprecated. Please use 'chat' parameter in the permissions instead."); + } this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit; this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canRename = this.editorConfig.canRename; diff --git a/apps/documenteditor/mobile/src/store/appOptions.js b/apps/documenteditor/mobile/src/store/appOptions.js index 3e0d1ac8d..ff7aacfad 100644 --- a/apps/documenteditor/mobile/src/store/appOptions.js +++ b/apps/documenteditor/mobile/src/store/appOptions.js @@ -114,7 +114,7 @@ export class storeAppOptions { this.canViewComments = this.canComments || !((typeof (this.customization) == 'object') && this.customization.comments===false); this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly); this.canDeleteComments= this.isOffline || !permissions.deleteCommentAuthorOnly; - this.canChat = this.canLicense && !this.isOffline && !((typeof (this.customization) == 'object') && this.customization.chat === false); + this.canChat = this.canLicense && !this.isOffline && (permissions.chat !== false); this.canEditStyles = this.canLicense && this.canEdit; this.canPrint = (permissions.print !== false); this.fileKey = document.key; diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 6f513c7f9..3153324ad 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1103,7 +1103,11 @@ define([ 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.canViewComments = 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.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !(this.permissions.chat===false || (this.permissions.chat===undefined) && + (typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); + if ((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat!==undefined) { + console.log("Obsolete: The 'chat' parameter of the 'customization' section is deprecated. Please use 'chat' parameter in the permissions instead."); + } this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canRename = this.editorConfig.canRename; this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); diff --git a/apps/presentationeditor/mobile/src/store/appOptions.js b/apps/presentationeditor/mobile/src/store/appOptions.js index 4ab711617..e1629bca1 100644 --- a/apps/presentationeditor/mobile/src/store/appOptions.js +++ b/apps/presentationeditor/mobile/src/store/appOptions.js @@ -92,7 +92,7 @@ export class storeAppOptions { this.canViewComments = this.canComments || !((typeof (this.customization) == 'object') && this.customization.comments===false); this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly); this.canDeleteComments= this.isOffline || !permissions.deleteCommentAuthorOnly; - this.canChat = this.canLicense && !this.isOffline && !((typeof (this.customization) == 'object') && this.customization.chat === false); + this.canChat = this.canLicense && !this.isOffline && (permissions.chat !== false); this.canEditStyles = this.canLicense && this.canEdit; this.canPrint = (permissions.print !== false); this.isRestrictedEdit = !this.isEdit && this.canComments; diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index d407712ba..45cc3f9a7 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1197,7 +1197,11 @@ define([ 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.canViewComments = 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.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !(this.permissions.chat===false || (this.permissions.chat===undefined) && + (typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); + if ((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat!==undefined) { + console.log("Obsolete: The 'chat' parameter of the 'customization' section is deprecated. Please use 'chat' parameter in the permissions instead."); + } this.appOptions.canRename = this.editorConfig.canRename; this.appOptions.buildVersion = params.asc_getBuildVersion(); this.appOptions.trialMode = params.asc_getLicenseMode(); diff --git a/apps/spreadsheeteditor/mobile/src/store/appOptions.js b/apps/spreadsheeteditor/mobile/src/store/appOptions.js index 4d405549b..c421ffa0d 100644 --- a/apps/spreadsheeteditor/mobile/src/store/appOptions.js +++ b/apps/spreadsheeteditor/mobile/src/store/appOptions.js @@ -92,7 +92,7 @@ export class storeAppOptions { this.canViewComments = this.canComments || !((typeof (this.customization) == 'object') && this.customization.comments===false); this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly); this.canDeleteComments= this.isOffline || !permissions.deleteCommentAuthorOnly; - this.canChat = this.canLicense && !this.isOffline && !((typeof (this.customization) == 'object') && this.customization.chat === false); + this.canChat = this.canLicense && !this.isOffline && (permissions.chat !== false); this.canPrint = (permissions.print !== false); this.isRestrictedEdit = !this.isEdit && this.canComments; this.trialMode = params.asc_getLicenseMode();