From 8682735906304b28dd627d4487138787bbc75290 Mon Sep 17 00:00:00 2001 From: Andrey Shimagin Date: Tue, 19 Apr 2022 15:54:18 +0300 Subject: [PATCH 1/3] [DE PE SSE] Fix Bug 56709 --- apps/common/mobile/lib/view/collaboration/Comments.jsx | 4 ++-- apps/documenteditor/mobile/src/store/appOptions.js | 4 ++-- apps/presentationeditor/mobile/src/store/appOptions.js | 4 ++-- apps/spreadsheeteditor/mobile/src/store/appOptions.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/common/mobile/lib/view/collaboration/Comments.jsx b/apps/common/mobile/lib/view/collaboration/Comments.jsx index 582a7bd99..d8927fca7 100644 --- a/apps/common/mobile/lib/view/collaboration/Comments.jsx +++ b/apps/common/mobile/lib/view/collaboration/Comments.jsx @@ -639,7 +639,7 @@ const ViewComments = inject("storeComments", "storeAppOptions", "storeReview")(o const viewMode = !storeAppOptions.canComments; const comments = storeComments.groupCollectionFilter || storeComments.collectionComments; - const isEdit = storeAppOptions.isEdit; + const isEdit = storeAppOptions.isEdit || storeAppOptions.isRestrictedEdit; const sortComments = comments.length > 0 ? [...comments].sort((a, b) => a.time > b.time ? -1 : 1) : null; const [clickComment, setComment] = useState(); @@ -749,7 +749,7 @@ const CommentList = inject("storeComments", "storeAppOptions", "storeReview")(ob const displayMode = storeReview.displayMode; const viewMode = !storeAppOptions.canComments; - const isEdit = storeAppOptions.isEdit; + const isEdit = storeAppOptions.isEdit || storeAppOptions.isRestrictedEdit; const comments = storeComments.showComments; const [currentIndex, setCurrentIndex] = useState(0); diff --git a/apps/documenteditor/mobile/src/store/appOptions.js b/apps/documenteditor/mobile/src/store/appOptions.js index 83a839d05..9a4bddfcf 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.canComments = this.canLicense && (permissions.comment === undefined ? this.isEdit : permissions.comment) && (this.config.mode !== 'view'); this.canComments = this.canComments && !((typeof (this.customization) == 'object') && this.customization.comments===false); this.canViewComments = this.canComments || !((typeof (this.customization) == 'object') && this.customization.comments===false); - this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly); + this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly) || !permissions.editCommentAuthorOnly; this.canDeleteComments= this.isOffline || !permissions.deleteCommentAuthorOnly; this.canChat = this.canLicense && !this.isOffline && (permissions.chat !== false); this.canEditStyles = this.canLicense && this.canEdit; @@ -122,7 +122,7 @@ export class storeAppOptions { this.fileKey = document.key; const typeForm = /^(?:(oform))$/.exec(document.fileType); // can fill forms only in oform format this.canFillForms = this.canLicense && !!(typeForm && typeof typeForm[1] === 'string') && ((permissions.fillForms===undefined) ? this.isEdit : permissions.fillForms) && (this.config.mode !== 'view'); - this.isRestrictedEdit = !this.isEdit && (this.canComments || this.canFillForms); + this.isRestrictedEdit = !this.isEdit && (this.canComments || this.canFillForms) && isSupportEditFeature; if (this.isRestrictedEdit && this.canComments && this.canFillForms) // must be one restricted mode, priority for filling forms this.canComments = false; this.trialMode = params.asc_getLicenseMode(); diff --git a/apps/presentationeditor/mobile/src/store/appOptions.js b/apps/presentationeditor/mobile/src/store/appOptions.js index 97b83a381..8bcca3785 100644 --- a/apps/presentationeditor/mobile/src/store/appOptions.js +++ b/apps/presentationeditor/mobile/src/store/appOptions.js @@ -94,12 +94,12 @@ export class storeAppOptions { this.canComments = this.canLicense && (permissions.comment === undefined ? this.isEdit : permissions.comment) && (this.config.mode !== 'view'); this.canComments = this.canComments && !((typeof (this.customization) == 'object') && this.customization.comments===false); this.canViewComments = this.canComments || !((typeof (this.customization) == 'object') && this.customization.comments===false); - this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly); + this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly) || !permissions.editCommentAuthorOnly; this.canDeleteComments= this.isOffline || !permissions.deleteCommentAuthorOnly; 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; + this.isRestrictedEdit = !this.isEdit && this.canComments && isSupportEditFeature; this.trialMode = params.asc_getLicenseMode(); const type = /^(?:(pdf|djvu|xps|oxps))$/.exec(document.fileType); diff --git a/apps/spreadsheeteditor/mobile/src/store/appOptions.js b/apps/spreadsheeteditor/mobile/src/store/appOptions.js index cdecf77b8..0ab2a34c9 100644 --- a/apps/spreadsheeteditor/mobile/src/store/appOptions.js +++ b/apps/spreadsheeteditor/mobile/src/store/appOptions.js @@ -94,11 +94,11 @@ export class storeAppOptions { this.canComments = this.canLicense && (permissions.comment === undefined ? this.isEdit : permissions.comment) && (this.config.mode !== 'view'); this.canComments = this.canComments && !((typeof (this.customization) == 'object') && this.customization.comments===false); this.canViewComments = this.canComments || !((typeof (this.customization) == 'object') && this.customization.comments===false); - this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly); + this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly) || !permissions.editCommentAuthorOnly; this.canDeleteComments= this.isOffline || !permissions.deleteCommentAuthorOnly; this.canChat = this.canLicense && !this.isOffline && (permissions.chat !== false); this.canPrint = (permissions.print !== false); - this.isRestrictedEdit = !this.isEdit && this.canComments; + this.isRestrictedEdit = !this.isEdit && this.canComments && isSupportEditFeature; this.trialMode = params.asc_getLicenseMode(); const type = /^(?:(pdf|djvu|xps|oxps))$/.exec(document.fileType); From b3d2bea6197ce8c8af959b87f7abcf4e7a53f1d9 Mon Sep 17 00:00:00 2001 From: Andrey Shimagin Date: Tue, 19 Apr 2022 17:04:38 +0300 Subject: [PATCH 2/3] [SSE] Fix Bug 56714 --- .../mobile/src/controller/ContextMenu.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx b/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx index d21cff870..8deb76aa2 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx @@ -14,6 +14,7 @@ import EditorUIController from '../lib/patch'; canComments: stores.storeAppOptions.canComments, canViewComments: stores.storeAppOptions.canViewComments, canCoAuthoring: stores.storeAppOptions.canCoAuthoring, + isRestrictedEdit: stores.storeAppOptions.isRestrictedEdit, users: stores.users, isDisconnected: stores.users.isDisconnected, storeSheets: stores.sheets, @@ -215,12 +216,12 @@ class ContextMenu extends ContextMenuController { const { t } = this.props; const _t = t("ContextMenu", { returnObjects: true }); - const { isEdit, isDisconnected } = this.props; + const { isEdit, isRestrictedEdit, isDisconnected } = this.props; if (isEdit && EditorUIController.ContextMenu) { return EditorUIController.ContextMenu.mapMenuItems(this); } else { - const {canViewComments} = this.props; + const {canViewComments, canCoAuthoring, canComments} = this.props; const api = Common.EditorApi.get(); const cellinfo = api.asc_getCellInfo(); @@ -262,6 +263,13 @@ class ContextMenu extends ContextMenuController { event: 'viewcomment' }); } + + if (iscellmenu && !api.isCellEdited && isRestrictedEdit && canCoAuthoring && canComments && hasComments && hasComments.length<1) { + itemsText.push({ + caption: _t.menuAddComment, + event: 'addcomment' + }); + } } return itemsIcon.concat(itemsText); From 0a5733c38113cae5cc278bba82443dc8bc36a9ea Mon Sep 17 00:00:00 2001 From: Andrey Shimagin Date: Wed, 20 Apr 2022 14:41:58 +0300 Subject: [PATCH 3/3] Update parameters in section "permissions" for editComments --- apps/documenteditor/mobile/src/store/appOptions.js | 7 ++++++- apps/presentationeditor/mobile/src/store/appOptions.js | 7 ++++++- apps/spreadsheeteditor/mobile/src/store/appOptions.js | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/mobile/src/store/appOptions.js b/apps/documenteditor/mobile/src/store/appOptions.js index 9a4bddfcf..29fba4077 100644 --- a/apps/documenteditor/mobile/src/store/appOptions.js +++ b/apps/documenteditor/mobile/src/store/appOptions.js @@ -114,8 +114,13 @@ export class storeAppOptions { this.canComments = this.canLicense && (permissions.comment === undefined ? this.isEdit : permissions.comment) && (this.config.mode !== 'view'); this.canComments = this.canComments && !((typeof (this.customization) == 'object') && this.customization.comments===false); this.canViewComments = this.canComments || !((typeof (this.customization) == 'object') && this.customization.comments===false); - this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly) || !permissions.editCommentAuthorOnly; + this.canEditComments = this.isOffline || !permissions.editCommentAuthorOnly; this.canDeleteComments= this.isOffline || !permissions.deleteCommentAuthorOnly; + if ((typeof (this.customization) == 'object') && this.customization.commentAuthorOnly===true) { + console.log("Obsolete: The 'commentAuthorOnly' parameter of the 'customization' section is deprecated. Please use 'editCommentAuthorOnly' and 'deleteCommentAuthorOnly' parameters in the permissions instead."); + if (permissions.editCommentAuthorOnly===undefined && permissions.deleteCommentAuthorOnly===undefined) + this.canEditComments = this.canDeleteComments = this.isOffline; + } this.canChat = this.canLicense && !this.isOffline && (permissions.chat !== false); this.canEditStyles = this.canLicense && this.canEdit; this.canPrint = (permissions.print !== false); diff --git a/apps/presentationeditor/mobile/src/store/appOptions.js b/apps/presentationeditor/mobile/src/store/appOptions.js index 8bcca3785..71f5563de 100644 --- a/apps/presentationeditor/mobile/src/store/appOptions.js +++ b/apps/presentationeditor/mobile/src/store/appOptions.js @@ -94,8 +94,13 @@ export class storeAppOptions { this.canComments = this.canLicense && (permissions.comment === undefined ? this.isEdit : permissions.comment) && (this.config.mode !== 'view'); this.canComments = this.canComments && !((typeof (this.customization) == 'object') && this.customization.comments===false); this.canViewComments = this.canComments || !((typeof (this.customization) == 'object') && this.customization.comments===false); - this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly) || !permissions.editCommentAuthorOnly; + this.canEditComments = this.isOffline || !permissions.editCommentAuthorOnly; this.canDeleteComments= this.isOffline || !permissions.deleteCommentAuthorOnly; + if ((typeof (this.customization) == 'object') && this.customization.commentAuthorOnly===true) { + console.log("Obsolete: The 'commentAuthorOnly' parameter of the 'customization' section is deprecated. Please use 'editCommentAuthorOnly' and 'deleteCommentAuthorOnly' parameters in the permissions instead."); + if (permissions.editCommentAuthorOnly===undefined && permissions.deleteCommentAuthorOnly===undefined) + this.canEditComments = this.canDeleteComments = this.isOffline; + } this.canChat = this.canLicense && !this.isOffline && (permissions.chat !== false); this.canEditStyles = this.canLicense && this.canEdit; this.canPrint = (permissions.print !== false); diff --git a/apps/spreadsheeteditor/mobile/src/store/appOptions.js b/apps/spreadsheeteditor/mobile/src/store/appOptions.js index 0ab2a34c9..061c4cb8b 100644 --- a/apps/spreadsheeteditor/mobile/src/store/appOptions.js +++ b/apps/spreadsheeteditor/mobile/src/store/appOptions.js @@ -94,8 +94,13 @@ export class storeAppOptions { this.canComments = this.canLicense && (permissions.comment === undefined ? this.isEdit : permissions.comment) && (this.config.mode !== 'view'); this.canComments = this.canComments && !((typeof (this.customization) == 'object') && this.customization.comments===false); this.canViewComments = this.canComments || !((typeof (this.customization) == 'object') && this.customization.comments===false); - this.canEditComments = this.isOffline || !(typeof (this.customization) == 'object' && this.customization.commentAuthorOnly) || !permissions.editCommentAuthorOnly; + this.canEditComments = this.isOffline || !permissions.editCommentAuthorOnly; this.canDeleteComments= this.isOffline || !permissions.deleteCommentAuthorOnly; + if ((typeof (this.customization) == 'object') && this.customization.commentAuthorOnly===true) { + console.log("Obsolete: The 'commentAuthorOnly' parameter of the 'customization' section is deprecated. Please use 'editCommentAuthorOnly' and 'deleteCommentAuthorOnly' parameters in the permissions instead."); + if (permissions.editCommentAuthorOnly===undefined && permissions.deleteCommentAuthorOnly===undefined) + this.canEditComments = this.canDeleteComments = this.isOffline; + } this.canChat = this.canLicense && !this.isOffline && (permissions.chat !== false); this.canPrint = (permissions.print !== false); this.isRestrictedEdit = !this.isEdit && this.canComments && isSupportEditFeature;