From dbfcca56523a877694bd2b2b546ccc8e173c2ec9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 21 Dec 2020 14:07:00 +0300 Subject: [PATCH] Disable favorite button for offline files --- apps/documenteditor/main/app/controller/Main.js | 6 +++--- apps/presentationeditor/main/app/controller/Main.js | 6 +++--- apps/spreadsheeteditor/main/app/controller/Main.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 408c7d531..8f5b4d13c 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -441,8 +441,6 @@ define([ if (type && typeof type[1] === 'string') { this.permissions.edit = this.permissions.review = false; } - - this.appOptions.canFavorite = data.doc.info && (data.doc.info.favorite!==undefined && data.doc.info.favorite!==null); } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); @@ -454,7 +452,6 @@ define([ if (data.doc) { appHeader.setDocumentCaption(data.doc.title); } - this.appOptions.canFavorite && appHeader.setFavorite(data.doc.info.favorite); }, onProcessSaveResult: function(data) { @@ -1298,6 +1295,9 @@ define([ if (this.appOptions.canBranding) appHeader.setBranding(this.editorConfig.customization); + this.appOptions.canFavorite = this.document.info && (this.document.info.favorite!==undefined && this.document.info.favorite!==null) && !this.appOptions.isOffline; + this.appOptions.canFavorite && appHeader.setFavorite(this.document.info.favorite); + this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object'); Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions); appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(this.appOptions.user.fullname)); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 25835ea09..f503cd69d 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -392,8 +392,6 @@ define([ docInfo.asc_putIsEnabledMacroses(!!enable); enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); docInfo.asc_putIsEnabledPlugins(!!enable); - - this.appOptions.canFavorite = data.doc.info && (data.doc.info.favorite!==undefined && data.doc.info.favorite!==null); } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); @@ -405,7 +403,6 @@ define([ if (data.doc) { appHeader.setDocumentCaption(data.doc.title); } - this.appOptions.canFavorite && appHeader.setFavorite(data.doc.info.favorite); }, onProcessSaveResult: function(data) { @@ -999,6 +996,9 @@ define([ if (this.appOptions.canBranding) appHeader.setBranding(this.editorConfig.customization); + this.appOptions.canFavorite = this.document.info && (this.document.info.favorite!==undefined && this.document.info.favorite!==null) && !this.appOptions.isOffline; + this.appOptions.canFavorite && appHeader.setFavorite(this.document.info.favorite); + this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object'); Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions); appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(this.appOptions.user.fullname)); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 646ecb20b..2afebab15 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -446,9 +446,6 @@ define([ docInfo.asc_putIsEnabledPlugins(!!enable); this.headerView && this.headerView.setDocumentCaption(data.doc.title); - this.appOptions.canFavorite = data.doc.info && (data.doc.info.favorite!==undefined && data.doc.info.favorite!==null); - this.appOptions.canFavorite && this.headerView && this.headerView.setFavorite(data.doc.info.favorite); - Common.Utils.InternalSettings.set("sse-doc-info-key", data.doc.key); } @@ -1053,6 +1050,9 @@ define([ if (this.appOptions.canBranding) this.headerView.setBranding(this.editorConfig.customization); + this.appOptions.canFavorite = this.appOptions.spreadsheet.info && (this.appOptions.spreadsheet.info.favorite!==undefined && this.appOptions.spreadsheet.info.favorite!==null); + this.appOptions.canFavorite && this.headerView && this.headerView.setFavorite(this.appOptions.spreadsheet.info.favorite); + this.appOptions.canRename && this.headerView.setCanRename(true); this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object'); Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions);