From 7cc14b5f2685498cc587337e5892bb1a3b88ae46 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 16 Mar 2021 13:46:44 +0300 Subject: [PATCH 1/8] Refactoring review permissions --- apps/common/main/lib/controller/ReviewChanges.js | 7 +------ apps/common/main/lib/util/utils.js | 5 +++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index a9227d93b..87070b0ea 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -464,7 +464,7 @@ define([ scope : me.view, hint : !me.appConfig.canReview, goto : (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom), - editable : me.appConfig.isReviewOnly && (item.get_UserId() == me.currentUserId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || me.checkUserGroups(item.get_UserName())) + editable : me.appConfig.isReviewOnly && (item.get_UserId() == me.currentUserId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || Common.Utils.UserInfoParser.canEditReview(item.get_UserName())) }); arr.push(change); @@ -472,11 +472,6 @@ define([ return arr; }, - checkUserGroups: function(username) { - var groups = Common.Utils.UserInfoParser.getParsedGroups(username); - return Common.Utils.UserInfoParser.getCurrentGroups() && groups && (_.intersection(Common.Utils.UserInfoParser.getCurrentGroups(), (groups.length>0) ? groups : [""]).length>0); - }, - getUserName: function(id){ if (this.userCollection && id!==null){ var rec = this.userCollection.findUser(id); diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 5bdca2530..7f4020951 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -1040,6 +1040,11 @@ Common.Utils.UserInfoParser = new(function() { getCurrentGroups: function() { return usergroups; + }, + + canEditReview: function(username) { + var groups = this.getParsedGroups(username); + return usergroups && groups && (_.intersection(usergroups, (groups.length>0) ? groups : [""]).length>0); } } })(); \ No newline at end of file From 5a373f76bb202cadb777873e0f89bce801879ac8 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 16 Mar 2021 20:17:35 +0300 Subject: [PATCH 2/8] [DE mobile] Refactoring review permissions --- .../mobile/lib/controller/Collaboration.js | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index 5b8896eb9..52a6aa3d8 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -63,8 +63,7 @@ define([ canViewReview, arrChangeReview = [], dateChange = [], - _fileKey, - _currentUserGroups; + _fileKey; return { @@ -116,17 +115,6 @@ define([ _fileKey = mode.fileKey; } - if (mode && mode.canUseReviewPermissions) { - var permissions = mode.customization.reviewPermissions, - arr = [], - groups = Common.Utils.UserInfoParser.getParsedGroups(Common.Utils.UserInfoParser.getCurrentName()); - groups && groups.forEach(function(group) { - var item = permissions[group.trim()]; - item && (arr = arr.concat(item)); - }); - _currentUserGroups = arr; - } - return this; }, @@ -711,7 +699,7 @@ define([ userColor = item.get_UserColor(), goto = (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom); date = me.dateToLocaleTimeString(date); - var editable = me.appConfig.isReviewOnly && (item.get_UserId() == _userId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || me.checkUserGroups(item.get_UserName())); + var editable = me.appConfig.isReviewOnly && (item.get_UserId() == _userId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || Common.Utils.UserInfoParser.canEditReview(item.get_UserName())); arr.push({date: date, user: user, usercolor: userColor, changetext: changetext, goto: goto, editable: editable}); }); arrChangeReview = arr; @@ -723,11 +711,6 @@ define([ this.updateInfoChange(); }, - checkUserGroups: function(username) { - var groups = Common.Utils.UserInfoParser.getParsedGroups(username); - return _currentUserGroups && groups && (_.intersection(_currentUserGroups, (groups.length>0) ? groups : [""]).length>0); - }, - dateToLocaleTimeString: function (date) { function format(date) { var strTime, From f35e929713065f6768a2fd64a62aca3db841c17d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 17 Mar 2021 12:02:06 +0300 Subject: [PATCH 3/8] Add permissions for edit/remove comments --- apps/api/documents/api.js | 5 ++ apps/common/main/lib/controller/Comments.js | 18 ++--- .../main/lib/template/Comments.template | 2 + .../lib/template/CommentsPopover.template | 2 + apps/common/main/lib/util/utils.js | 75 ++++++++++++++----- .../mobile/lib/controller/Collaboration.js | 38 +++++----- .../main/app/controller/Main.js | 4 +- .../mobile/app/controller/Main.js | 6 +- .../main/app/controller/Main.js | 4 +- .../mobile/app/controller/Main.js | 6 +- .../main/app/controller/Main.js | 4 +- .../mobile/app/controller/Main.js | 4 +- 12 files changed, 115 insertions(+), 53 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 20ec5730d..7f7ccc3a6 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -51,6 +51,11 @@ editCommentAuthorOnly: // default = false deleteCommentAuthorOnly: // default = false, reviewGroups: ["Group1", ""] // current user can accept/reject review changes made by users from Group1 and users without a group. [] - use groups, but can't change any group's changes + commentGroups: { // {} - use groups, but can't view/edit/delete any group's comments + view: ["Group1", ""] // current user can view comments made by users from Group1 and users without a group. + edit: ["Group1", ""] // current user can edit comments made by users from Group1 and users without a group. + remove: ["Group1", ""] // current user can remove comments made by users from Group1 and users without a group. + } } }, editorConfig: { diff --git a/apps/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js index f07c5b31c..1f32e1139 100644 --- a/apps/common/main/lib/controller/Comments.js +++ b/apps/common/main/lib/controller/Comments.js @@ -776,8 +776,8 @@ define([ comment.set('userdata', data.asc_getUserData()); comment.set('time', date.getTime()); comment.set('date', t.dateToLocaleTimeString(date)); - comment.set('editable', t.mode.canEditComments || (data.asc_getUserId() == t.currentUserId)); - comment.set('removable', t.mode.canDeleteComments || (data.asc_getUserId() == t.currentUserId)); + comment.set('editable', (t.mode.canEditComments || (data.asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getUserName())); + comment.set('removable', (t.mode.canDeleteComments || (data.asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getUserName())); replies = _.clone(comment.get('replys')); @@ -803,8 +803,8 @@ define([ editTextInPopover : false, showReplyInPopover : false, scope : t.view, - editable : t.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId), - removable : t.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId) + editable : (t.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getReply(i).asc_getUserName()), + removable : (t.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName()) })); } @@ -1243,8 +1243,8 @@ define([ showReplyInPopover : false, hideAddReply : !_.isUndefined(this.hidereply) ? this.hidereply : (this.showPopover ? true : false), scope : this.view, - editable : this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId), - removable : this.mode.canDeleteComments || (data.asc_getUserId() == this.currentUserId), + editable : (this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getUserName()), + removable : (this.mode.canDeleteComments || (data.asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getUserName()), hint : !this.mode.canComments, groupName : (groupname && groupname.length>1) ? groupname[1] : null }); @@ -1281,8 +1281,8 @@ define([ editTextInPopover : false, showReplyInPopover : false, scope : this.view, - editable : this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId), - removable : this.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId) + editable : (this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getReply(i).asc_getUserName()), + removable : (this.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName()) })); } } @@ -1443,7 +1443,7 @@ define([ for (i = 0; i < comments.length; ++i) { comment = this.findComment(comments[i].asc_getId()); if (comment) { - comment.set('editTextInPopover', t.mode.canEditComments);// dont't edit comment when customization->commentAuthorOnly is true or when permissions.editCommentAuthorOnly is true + comment.set('editTextInPopover', t.mode.canEditComments && Common.Utils.UserInfoParser.canEditComment(comment.username));// dont't edit comment when customization->commentAuthorOnly is true or when permissions.editCommentAuthorOnly is true comment.set('hint', false); this.popoverComments.push(comment); } diff --git a/apps/common/main/lib/template/Comments.template b/apps/common/main/lib/template/Comments.template index 2ff20c34e..82a1e531b 100644 --- a/apps/common/main/lib/template/Comments.template +++ b/apps/common/main/lib/template/Comments.template @@ -73,7 +73,9 @@ <% if (removable) { %>
<% } %> + <% if (editable) { %>
+ <% } %> <% } %> diff --git a/apps/common/main/lib/template/CommentsPopover.template b/apps/common/main/lib/template/CommentsPopover.template index d74214b34..9bd905834 100644 --- a/apps/common/main/lib/template/CommentsPopover.template +++ b/apps/common/main/lib/template/CommentsPopover.template @@ -74,7 +74,9 @@ <% if (removable) { %>
<% } %> + <% if (editable) { %>
+ <% } %> <% } %> diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 7f4020951..51fe76578 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -982,9 +982,20 @@ Common.Utils.UserInfoParser = new(function() { var parse = false, separator = String.fromCharCode(160), username = '', - usergroups, - reviewPermissions, - reviewGroups; + _reviewPermissions, + reviewGroups, + commentGroups; + + var _intersection = function (arr1, arr2) { + if (arr1 && arr2) { + for (var i=0; i-1) + return true; + } + } + return false; + }; + return { setParser: function(value) { parse = !!value; @@ -995,10 +1006,7 @@ Common.Utils.UserInfoParser = new(function() { }, getParsedName: function(username) { - if (parse && username) { - return username.substring(username.indexOf(separator)+1); - } else - return username; + return (parse && username) ? username.substring(username.indexOf(separator)+1) : username; }, getParsedGroups: function(username) { @@ -1008,13 +1016,12 @@ Common.Utils.UserInfoParser = new(function() { for (var i=0; i0) - usergroups = groups; - reviewGroups = groups; - } else if (permissions) { + reviewGroups = groups; + } else if (permissions) { // old version of review permissions var arr = [], arrgroups = this.getParsedGroups(username); arrgroups && arrgroups.forEach(function(group) { var item = permissions[group.trim()]; item && (arr = arr.concat(item)); }); - usergroups = arr; - reviewPermissions = permissions; + reviewGroups = arr; + _reviewPermissions = permissions; } }, - getCurrentGroups: function() { - return usergroups; + setCommentPermissions: function(groups) { + if (groups && typeof groups == 'object') { + commentGroups = { + view: (typeof groups.view == 'object' && groups.view.length>0) ? groups.view : null, + edit: (typeof groups.edit == 'object' && groups.edit.length>0) ? groups.edit : null, + remove: (typeof groups.remove == 'object' && groups.remove.length>0) ? groups.remove : null + }; + } }, canEditReview: function(username) { + if (!parse || !reviewGroups) return true; + var groups = this.getParsedGroups(username); - return usergroups && groups && (_.intersection(usergroups, (groups.length>0) ? groups : [""]).length>0); + groups && (groups.length==0) && (groups = [""]); + return _intersection(reviewGroups, groups); + }, + + canViewComment: function(username) { + if (!parse || !commentGroups) return true; + + var groups = this.getParsedGroups(username); + groups && (groups.length==0) && (groups = [""]); + return _intersection(commentGroups.view, groups); + }, + + canEditComment: function(username) { + if (!parse || !commentGroups) return true; + + var groups = this.getParsedGroups(username); + groups && (groups.length==0) && (groups = [""]); + return _intersection(commentGroups.edit, groups); + }, + + canDeleteComment: function(username) { + if (!parse || !commentGroups) return true; + + var groups = this.getParsedGroups(username); + groups && (groups.length==0) && (groups = [""]); + return _intersection(commentGroups.remove, groups); } } })(); \ No newline at end of file diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index 52a6aa3d8..07ff35429 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -1131,16 +1131,18 @@ define([ caption: me.textEdit, event: 'edit' }); - if (!comment.resolved) { - _menuItems.push({ - caption: me.textResolve, - event: 'resolve' - }); - } else { - _menuItems.push({ - caption: me.textReopen, - event: 'resolve' - }); + if (comment.editable) { + if (!comment.resolved) { + _menuItems.push({ + caption: me.textResolve, + event: 'resolve' + }); + } else { + _menuItems.push({ + caption: me.textReopen, + event: 'resolve' + }); + } } if ($('.container-collaboration').length > 0) { _menuItems.push({ @@ -1540,8 +1542,8 @@ define([ reply : data.asc_getReply(i).asc_getText(), time : date.getTime(), userInitials : this.getInitials(username), - editable : this.appConfig.canEditComments || (data.asc_getReply(i).asc_getUserId() == _userId), - removable : this.appConfig.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == _userId) + editable : (this.appConfig.canEditComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canEditComment(username), + removable : (this.appConfig.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(username) }); } } @@ -1570,8 +1572,8 @@ define([ replys : [], groupName : (groupname && groupname.length>1) ? groupname[1] : null, userInitials : this.getInitials(username), - editable : this.appConfig.canEditComments || (data.asc_getUserId() == _userId), - removable : this.appConfig.canDeleteComments || (data.asc_getUserId() == _userId) + editable : (this.appConfig.canEditComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canEditComment(username), + removable : (this.appConfig.canDeleteComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(username) }; if (comment) { var replies = this.readSDKReplies(data); @@ -1607,8 +1609,8 @@ define([ comment.quote = data.asc_getQuoteText(); comment.time = date.getTime(); comment.date = me.dateToLocaleTimeString(date); - comment.editable = me.appConfig.canEditComments || (data.asc_getUserId() == _userId); - comment.removable = me.appConfig.canDeleteComments || (data.asc_getUserId() == _userId); + comment.editable = (me.appConfig.canEditComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getUserName()); + comment.removable = (me.appConfig.canDeleteComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getUserName()); replies = _.clone(comment.replys); @@ -1633,8 +1635,8 @@ define([ reply : data.asc_getReply(i).asc_getText(), time : dateReply.getTime(), userInitials : me.getInitials(username), - editable : me.appConfig.canEditComments || (data.asc_getReply(i).asc_getUserId() == _userId), - removable : me.appConfig.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == _userId) + editable : (me.appConfig.canEditComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canEditComment(username), + removable : (me.appConfig.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(username) }); } comment.replys = replies; diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index f4e20e493..8737b4c79 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1333,9 +1333,11 @@ define([ this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroups || this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object')); - Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions); + this.appOptions.canUseCommentPermissions = this.appOptions.canLicense && !!this.permissions.commentGroups; + Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions || this.appOptions.canUseCommentPermissions); Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname); this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions); + this.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(this.permissions.commentGroups); appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName())); this.appOptions.canRename && appHeader.setCanRename(true); diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 30e047d66..b056ea509 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -839,10 +839,12 @@ define([ me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && (!!me.permissions.reviewGroups || me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object')); - Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions); + me.appOptions.canUseCommentPermissions = me.appOptions.canLicense && !!me.permissions.commentGroups; + Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions || me.appOptions.canUseCommentPermissions); Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname); me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.permissions.reviewGroups, me.editorConfig.customization.reviewPermissions); - + me.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(me.permissions.commentGroups); + me.applyModeCommonElements(); me.applyModeEditorElements(); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index ef200e2b0..3be23c570 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1034,9 +1034,11 @@ define([ this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroups || this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object')); - Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions); + this.appOptions.canUseCommentPermissions = this.appOptions.canLicense && !!this.permissions.commentGroups; + Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions || this.appOptions.canUseCommentPermissions); Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname); this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions); + this.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(this.permissions.commentGroups); appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName())); this.appOptions.canRename && appHeader.setCanRename(true); diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index 2ea83421d..a0d15686f 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -762,10 +762,12 @@ define([ me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && (!!me.permissions.reviewGroups || me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object')); - Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions); + me.appOptions.canUseCommentPermissions = me.appOptions.canLicense && !!me.permissions.commentGroups; + Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions || me.appOptions.canUseCommentPermissions); Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname); me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.permissions.reviewGroups, me.editorConfig.customization.reviewPermissions); - + me.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(me.permissions.commentGroups); + me.applyModeCommonElements(); me.applyModeEditorElements(); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 70ab7427e..f38c0003a 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1081,9 +1081,11 @@ define([ this.appOptions.canRename && this.headerView.setCanRename(true); this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroups || this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object')); - Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions); + this.appOptions.canUseCommentPermissions = this.appOptions.canLicense && !!this.permissions.commentGroups; + Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions || this.appOptions.canUseCommentPermissions); Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname); this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions); + this.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(this.permissions.commentGroups); this.headerView.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName())); } else this.appOptions.canModifyFilter = true; diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 2092e1f43..50fbab3e1 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -774,9 +774,11 @@ define([ me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && (!!me.permissions.reviewGroups || me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object')); - Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions); + me.appOptions.canUseCommentPermissions = me.appOptions.canLicense && !!me.permissions.commentGroups; + Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions || me.appOptions.canUseCommentPermissions); Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname); me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.permissions.reviewGroups, me.editorConfig.customization.reviewPermissions); + me.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(me.permissions.commentGroups); } me.appOptions.canRequestEditRights = me.editorConfig.canRequestEditRights; From 8a3a74dc2d7b3cea1378c11d28af5be6a1cf75cb Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 17 Mar 2021 20:08:47 +0300 Subject: [PATCH 4/8] Use config permssions to view comments --- apps/common/main/lib/controller/Comments.js | 36 +++++++++++++------ apps/common/main/lib/model/Comment.js | 3 +- .../main/lib/template/Comments.template | 9 +++-- .../lib/template/CommentsPopover.template | 16 ++++++--- 4 files changed, 45 insertions(+), 19 deletions(-) diff --git a/apps/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js index 1f32e1139..d6b3e56ee 100644 --- a/apps/common/main/lib/controller/Comments.js +++ b/apps/common/main/lib/controller/Comments.js @@ -778,6 +778,7 @@ define([ comment.set('date', t.dateToLocaleTimeString(date)); comment.set('editable', (t.mode.canEditComments || (data.asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getUserName())); comment.set('removable', (t.mode.canDeleteComments || (data.asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getUserName())); + comment.set('hide', !Common.Utils.UserInfoParser.canViewComment(data.asc_getUserName())); replies = _.clone(comment.get('replys')); @@ -804,12 +805,17 @@ define([ showReplyInPopover : false, scope : t.view, editable : (t.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getReply(i).asc_getUserName()), - removable : (t.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName()) + removable : (t.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName()), + hide : !Common.Utils.UserInfoParser.canViewComment(data.asc_getReply(i).asc_getUserName()) })); } comment.set('replys', replies); + if (!this.popoverComments.findWhere({hide: false})) { + this.getPopover() && this.getPopover().hideComments(); + } + if (!silentUpdate) { this.updateComments(false, true); @@ -924,12 +930,15 @@ define([ }); this.popoverComments.reset(comments); - if (popover.isVisible()) { - popover.hide(); - } + if (this.popoverComments.findWhere({hide: false})) { + if (popover.isVisible()) { + popover.hide(); + } - popover.setLeftTop(posX, posY, leftX); - popover.showComments(animate, false, true, text); + popover.setLeftTop(posX, posY, leftX); + popover.showComments(animate, false, true, text); + } else + popover.hideComments(); } this.isModeChanged = false; }, @@ -1007,9 +1016,12 @@ define([ }); this.popoverComments.reset(comments); - useAnimation = true; - this.getPopover().showComments(useAnimation, undefined, undefined, text); - } else if (!this.getPopover().isVisible()) { + if (this.popoverComments.findWhere({hide: false})) { + useAnimation = true; + this.getPopover().showComments(useAnimation, undefined, undefined, text); + } else + this.getPopover().hideComments(); + } else if (!this.getPopover().isVisible() && this.popoverComments.findWhere({hide: false})) { this.getPopover().showComments(false, undefined, undefined, text); } @@ -1245,6 +1257,7 @@ define([ scope : this.view, editable : (this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getUserName()), removable : (this.mode.canDeleteComments || (data.asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getUserName()), + hide : !Common.Utils.UserInfoParser.canViewComment(data.asc_getUserName()), hint : !this.mode.canComments, groupName : (groupname && groupname.length>1) ? groupname[1] : null }); @@ -1282,7 +1295,8 @@ define([ showReplyInPopover : false, scope : this.view, editable : (this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getReply(i).asc_getUserName()), - removable : (this.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName()) + removable : (this.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName()), + hide : !Common.Utils.UserInfoParser.canViewComment(data.asc_getReply(i).asc_getUserName()) })); } } @@ -1449,7 +1463,7 @@ define([ } } - if (this.getPopover() && this.popoverComments.length>0) { + if (this.getPopover() && this.popoverComments.length>0 && this.popoverComments.findWhere({hide: false})) { if (this.getPopover().isVisible()) { this.getPopover().hide(); } diff --git a/apps/common/main/lib/model/Comment.js b/apps/common/main/lib/model/Comment.js index 80c8667ba..e58713cfd 100644 --- a/apps/common/main/lib/model/Comment.js +++ b/apps/common/main/lib/model/Comment.js @@ -98,7 +98,8 @@ define([ editTextInPopover : false, scope : null, editable : true, - removable : true + removable : true, + hide : false } }); }); diff --git a/apps/common/main/lib/template/Comments.template b/apps/common/main/lib/template/Comments.template index 82a1e531b..4d587d722 100644 --- a/apps/common/main/lib/template/Comments.template +++ b/apps/common/main/lib/template/Comments.template @@ -22,9 +22,13 @@ + <% var add_arrow = true; %> <% if (replys.length) { %> -
<% _.each(replys, function (item, index) { %> + <% if (!item.get("hide")) { %> + <% if (add_arrow) { add_arrow = false; %> +
+ <% } %>
style="padding-bottom: 0;" <% } %>;>
<%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
<%= scope.getUserName(item.get("username")) %> @@ -50,13 +54,14 @@
<% } %>
+ <% } %> <% }); %> <% } %> <% if (!showReply && !scope.viewmode) { %> - <% if (replys.length) { %> + <% if (replys.length && !add_arrow) { %> <% } else { %> diff --git a/apps/common/main/lib/template/CommentsPopover.template b/apps/common/main/lib/template/CommentsPopover.template index 9bd905834..5f4c5911d 100644 --- a/apps/common/main/lib/template/CommentsPopover.template +++ b/apps/common/main/lib/template/CommentsPopover.template @@ -1,3 +1,4 @@ +<% if (!hide) { %>
@@ -22,9 +23,13 @@ + <% var add_arrow = true; %> <% if (replys.length) { %> -
<% _.each(replys, function (item) { %> + <% if (!item.get("hide")) { %> + <% if (add_arrow) { add_arrow = false; %> +
+ <% } %>
<%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
<%= scope.getUserName(item.get("username")) %> @@ -49,15 +54,15 @@
<% } %> -
+
+ <% } %> <% }); %> - <% } %> <% if (!showReplyInPopover && !hideAddReply && !hint) { %> - <% if (replys.length) { %> + <% if (replys.length && !add_arrow) { %> <% } else { %> @@ -97,4 +102,5 @@
<%=lockuserid%>
<% } %> - \ No newline at end of file + +<% } %> \ No newline at end of file From 916c911ac77d246bb4d3306e631d211664cbeaf1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 17 Mar 2021 23:57:54 +0300 Subject: [PATCH 5/8] [Mobile] Use config permssions to view comments --- .../mobile/lib/controller/Collaboration.js | 55 +++++++-- apps/common/mobile/lib/view/Collaboration.js | 113 ++++++++++-------- .../mobile/app/controller/DocumentHolder.js | 10 +- .../mobile/app/controller/DocumentHolder.js | 10 +- .../mobile/app/controller/DocumentHolder.js | 23 +++- 5 files changed, 139 insertions(+), 72 deletions(-) diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index 07ff35429..a178df72f 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -791,6 +791,16 @@ define([ return comment; }, + findVisibleComment: function(uid) { + var comment; + if (this.groupCollectionFilter.length !== 0) { + comment = this.findVisibleCommentInGroup(uid); + } else if (this.collectionComments.length !== 0) { + comment = _.findWhere(this.collectionComments, {uid: uid, hide: false}); + } + return comment; + }, + apiShowComments: function(uid) { var comments, me = this; @@ -988,12 +998,15 @@ define([ onViewPrevComment: function() { if (this.showComments && this.showComments.length > 0) { - if (this.indexCurrentComment - 1 < 0) { - this.indexCurrentComment = this.showComments.length - 1; - } else { - this.indexCurrentComment -= 1; + for (var i=0; i 0) { - if (this.indexCurrentComment + 1 === this.showComments.length) { - this.indexCurrentComment = 0; - } else { - this.indexCurrentComment += 1; + for (var i=0; i1) ? groupname[1] : null, userInitials : this.getInitials(username), editable : (this.appConfig.canEditComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canEditComment(username), - removable : (this.appConfig.canDeleteComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(username) + removable : (this.appConfig.canDeleteComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(username), + hide : !Common.Utils.UserInfoParser.canViewComment(username) }; if (comment) { var replies = this.readSDKReplies(data); @@ -1611,6 +1629,7 @@ define([ comment.date = me.dateToLocaleTimeString(date); comment.editable = (me.appConfig.canEditComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getUserName()); comment.removable = (me.appConfig.canDeleteComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getUserName()); + comment.hide = !Common.Utils.UserInfoParser.canViewComment(data.asc_getUserName()); replies = _.clone(comment.replys); @@ -1636,7 +1655,8 @@ define([ time : dateReply.getTime(), userInitials : me.getInitials(username), editable : (me.appConfig.canEditComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canEditComment(username), - removable : (me.appConfig.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(username) + removable : (me.appConfig.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(username), + hide : !Common.Utils.UserInfoParser.canViewComment(username) }); } comment.replys = replies; @@ -1708,6 +1728,15 @@ define([ } }, + findVisibleCommentInGroup: function (id) { + for (var name in this.groupCollectionComments) { + var store = this.groupCollectionComments[name]; + var id = _.isArray(id) ? id[0] : id; + var model = _.findWhere(store, {uid: id, hide: false}); + if (model) return model; + } + }, + onApiRemoveComment: function (id, silentUpdate) { function remove (collection, key) { if(collection instanceof Array) { diff --git a/apps/common/mobile/lib/view/Collaboration.js b/apps/common/mobile/lib/view/Collaboration.js index eaccfe03f..edf0137d9 100644 --- a/apps/common/mobile/lib/view/Collaboration.js +++ b/apps/common/mobile/lib/view/Collaboration.js @@ -165,66 +165,73 @@ define([ renderViewComments: function(comments, indCurComment) { var isAndroid = Framework7.prototype.device.android === true; var me = this; + var res = false; if ($('.page-view-comments .page-content').length > 0) { var template = ''; if (comments && comments.length > 0) { - template = '
' + - '
    '; var comment = comments[indCurComment]; - template += '
  • ' + - '
    ' + - '
    '; - if (isAndroid) { - template += '
    ' + comment.userInitials + '
    '; - } - template += '
    ' + me.getUserName(comment.username) + '
    ' + - '
    ' + comment.date + '
    '; - if (isAndroid) { + res = !comment.hide; + if (res) { + template = '
    ' + + '
      '; + template += '
    • ' + + '
      ' + + '
      '; + if (isAndroid) { + template += '
      ' + comment.userInitials + '
      '; + } + template += '
      ' + me.getUserName(comment.username) + '
      ' + + '
      ' + comment.date + '
      '; + if (isAndroid) { + template += '
      '; + } template += '
      '; - } - template += '
      '; - if (!me.viewmode) { - template += '
      ' + - '
      ' + - '
      ' + - '
      '; - } - template += '
      '; - - if (comment.quote) template += '
      ' + me.sliceQuote(comment.quote) + '
      '; - template += '
      ' + comment.comment + '
      '; - if (comment.replys.length > 0) { - template += '
        '; - _.each(comment.replys, function (reply) { - template += '
      • ' + - '
        ' + - '
        '; - if (isAndroid) { - template += '
        ' + reply.userInitials + '
        ' - } - template += '
        ' + me.getUserName(reply.username) + '
        ' + - '
        ' + reply.date + '
        ' + + if (!me.viewmode) { + template += '
        ' + + '
        ' + + '
        ' + '
        '; - if (isAndroid) { - template += '
        '; - } - if ((reply.editable || reply.removable) && !me.viewmode) { - template += '
        '; - } - template += '
        ' + - '
        ' + reply.reply + '
        ' + - '
      • '; - }); - template += '
      ' - } + } + template += '
    '; - template += '
    ' + - '
  • '; - template += '
'; - $('.page-view-comments .page-content').html(template); + if (comment.quote) template += '
' + me.sliceQuote(comment.quote) + '
'; + template += '
' + comment.comment + '
'; + if (comment.replys.length > 0) { + template += '
    '; + _.each(comment.replys, function (reply) { + if (!reply.hide) { + template += '
  • ' + + '
    ' + + '
    '; + if (isAndroid) { + template += '
    ' + reply.userInitials + '
    ' + } + template += '
    ' + me.getUserName(reply.username) + '
    ' + + '
    ' + reply.date + '
    ' + + '
    '; + if (isAndroid) { + template += '
    '; + } + if ((reply.editable || reply.removable) && !me.viewmode) { + template += '
    '; + } + template += '
    ' + + '
    ' + reply.reply + '
    ' + + '
  • '; + } + }); + template += '
' + } + + template += '' + + ''; + template += ''; + $('.page-view-comments .page-content').html(template); + } } } Common.Utils.addScrollIfNeed('.page-view-comments.page', '.page-view-comments .page-content'); + return res; }, renderComments: function (comments) { @@ -245,6 +252,7 @@ define([ items = []; _.each(sortComments, function (comment) { var itemTemplate = [ + '<% if (!item.hide) { %>', '
  • ', '
    ', '
    ', @@ -267,6 +275,7 @@ define([ '<% if(replys > 0) {%>', '
      ', '<% _.each(item.replys, function (reply) { %>', + '<% if (!reply.hide) { %>', '
    • ', '
      ', '
      ', @@ -281,11 +290,13 @@ define([ '
      ', '
      <%= reply.reply %>
      ', '
    • ', + '<% } %>', '<% }); %>', '
    ', '<% } %>', '
    ', - '
  • ' + '', + '<% } %>' ].join(''); items.push(_.template(itemTemplate)({ android: Framework7.prototype.device.android, diff --git a/apps/documenteditor/mobile/app/controller/DocumentHolder.js b/apps/documenteditor/mobile/app/controller/DocumentHolder.js index 23d8a035e..ba841b843 100644 --- a/apps/documenteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/documenteditor/mobile/app/controller/DocumentHolder.js @@ -454,7 +454,15 @@ define([ }, onApiShowComment: function(comments) { - _isComments = comments && comments.length>0; + _isComments = false; + if (comments && comments.length > 0) { + for (var i = 0; i < comments.length; ++i) { + if (this.getApplication().getController('Common.Controllers.Collaboration').findVisibleComment(comments[i])) { + _isComments = true; + break; + } + } + } }, onApiHideComment: function() { diff --git a/apps/presentationeditor/mobile/app/controller/DocumentHolder.js b/apps/presentationeditor/mobile/app/controller/DocumentHolder.js index eb815fb9c..0eb225b03 100644 --- a/apps/presentationeditor/mobile/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/mobile/app/controller/DocumentHolder.js @@ -90,7 +90,15 @@ define([ }, onApiShowComment: function(comments) { - _isComments = comments && comments.length>0; + _isComments = false; + if (comments && comments.length > 0) { + for (var i = 0; i < comments.length; ++i) { + if (this.getApplication().getController('Common.Controllers.Collaboration').findVisibleComment(comments[i])) { + _isComments = true; + break; + } + } + } }, onApiHideComment: function() { diff --git a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js index 25d9d72bc..14c262025 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js @@ -54,7 +54,8 @@ define([ var _actionSheets = [], _isEdit = false, _canViewComments = true, - _isComments = false; + _isComments = false, + _isVisibleComments = false; function openLink(url) { var newDocumentPage = window.open(url, '_blank'); @@ -321,8 +322,18 @@ define([ var iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu; var iscelllocked = cellinfo.asc_getLocked(), seltype = cellinfo.asc_getSelectionType(), - xfs = cellinfo.asc_getXfs(); - _isComments = cellinfo.asc_getComments().length>0; //prohibit adding multiple comments in one cell; + xfs = cellinfo.asc_getXfs(), + comments = cellinfo.asc_getComments(); + _isComments = comments.length>0; //prohibit adding multiple comments in one cell; + _isVisibleComments = false; + if (comments && comments.length > 0) { + for (var i = 0; i < comments.length; ++i) { + if (me.getApplication().getController('Common.Controllers.Collaboration').findVisibleComment(comments[i].asc_getId())) { + _isVisibleComments = true; + break; + } + } + } switch (seltype) { case Asc.c_oAscSelectionType.RangeCells: iscellmenu = true; break; @@ -350,7 +361,7 @@ define([ event: 'openlink' }); } - if (_canViewComments && _isComments) { + if (_canViewComments && _isVisibleComments) { arrItems.push({ caption: me.menuViewComment, event: 'viewcomment' @@ -463,12 +474,12 @@ define([ } if (_canViewComments) { - if (_isComments) { + if (_isVisibleComments) { arrItems.push({ caption: me.menuViewComment, event: 'viewcomment' }); - } else if (iscellmenu) { + } else if (iscellmenu && !_isComments) { arrItems.push({ caption: me.menuAddComment, event: 'addcomment' From 48ab72fb14704371a5df247beffcee77ad0550c1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 18 Mar 2021 00:03:49 +0300 Subject: [PATCH 6/8] Refactoring --- apps/common/main/lib/util/utils.js | 46 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 51fe76578..919b3876c 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -996,29 +996,21 @@ Common.Utils.UserInfoParser = new(function() { return false; }; + var _getParsedGroups = function(username) { + if (parse && username) { + var idx = username.indexOf(separator), + groups = (idx>-1) ? username.substring(0, idx).split(',') : []; + for (var i=0; i-1) ? username.substring(0, idx).split(',') : []; - for (var i=0; i0) reviewGroups = groups; } else if (permissions) { // old version of review permissions var arr = [], - arrgroups = this.getParsedGroups(username); + arrgroups = _getParsedGroups(username); arrgroups && arrgroups.forEach(function(group) { var item = permissions[group.trim()]; item && (arr = arr.concat(item)); @@ -1057,7 +1057,7 @@ Common.Utils.UserInfoParser = new(function() { canEditReview: function(username) { if (!parse || !reviewGroups) return true; - var groups = this.getParsedGroups(username); + var groups = _getParsedGroups(username); groups && (groups.length==0) && (groups = [""]); return _intersection(reviewGroups, groups); }, @@ -1065,7 +1065,7 @@ Common.Utils.UserInfoParser = new(function() { canViewComment: function(username) { if (!parse || !commentGroups) return true; - var groups = this.getParsedGroups(username); + var groups = _getParsedGroups(username); groups && (groups.length==0) && (groups = [""]); return _intersection(commentGroups.view, groups); }, @@ -1073,7 +1073,7 @@ Common.Utils.UserInfoParser = new(function() { canEditComment: function(username) { if (!parse || !commentGroups) return true; - var groups = this.getParsedGroups(username); + var groups = _getParsedGroups(username); groups && (groups.length==0) && (groups = [""]); return _intersection(commentGroups.edit, groups); }, @@ -1081,7 +1081,7 @@ Common.Utils.UserInfoParser = new(function() { canDeleteComment: function(username) { if (!parse || !commentGroups) return true; - var groups = this.getParsedGroups(username); + var groups = _getParsedGroups(username); groups && (groups.length==0) && (groups = [""]); return _intersection(commentGroups.remove, groups); } From 64b34da425eb80a5e4dfe3a233229f76fc47b580 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 18 Mar 2021 14:21:13 +0300 Subject: [PATCH 7/8] Comment groups: allow all actions, when view/edit/remove field is undefined --- apps/common/main/lib/util/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 919b3876c..56df35ac8 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -1063,7 +1063,7 @@ Common.Utils.UserInfoParser = new(function() { }, canViewComment: function(username) { - if (!parse || !commentGroups) return true; + if (!parse || !commentGroups || !commentGroups.view) return true; var groups = _getParsedGroups(username); groups && (groups.length==0) && (groups = [""]); @@ -1071,7 +1071,7 @@ Common.Utils.UserInfoParser = new(function() { }, canEditComment: function(username) { - if (!parse || !commentGroups) return true; + if (!parse || !commentGroups || !commentGroups.edit) return true; var groups = _getParsedGroups(username); groups && (groups.length==0) && (groups = [""]); @@ -1079,7 +1079,7 @@ Common.Utils.UserInfoParser = new(function() { }, canDeleteComment: function(username) { - if (!parse || !commentGroups) return true; + if (!parse || !commentGroups || !commentGroups.remove) return true; var groups = _getParsedGroups(username); groups && (groups.length==0) && (groups = [""]); From 3b901f91e4ab1f0d754b1138162d610d64f3f8e1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 26 Mar 2021 14:29:16 +0300 Subject: [PATCH 8/8] Use sdk class --- apps/common/main/lib/controller/Comments.js | 38 +++++++++---------- .../main/lib/controller/ReviewChanges.js | 6 +-- apps/common/main/lib/util/utils.js | 2 +- apps/common/main/lib/view/Chat.js | 2 +- apps/common/main/lib/view/Comments.js | 2 +- apps/common/main/lib/view/Header.js | 2 +- apps/common/main/lib/view/History.js | 2 +- apps/common/main/lib/view/ReviewChanges.js | 2 +- .../mobile/lib/controller/Collaboration.js | 30 +++++++-------- apps/common/mobile/lib/view/Collaboration.js | 2 +- .../main/app/controller/Main.js | 16 ++++---- .../main/app/view/DocumentHolder.js | 2 +- .../main/app/view/FileMenuPanels.js | 2 +- .../mobile/app/controller/DocumentHolder.js | 2 +- .../mobile/app/controller/Main.js | 12 +++--- .../mobile/app/controller/Settings.js | 2 +- .../mobile/app/view/add/AddOther.js | 2 +- .../main/app/controller/Main.js | 16 ++++---- .../main/app/view/DocumentHolder.js | 2 +- .../main/app/view/FileMenuPanels.js | 2 +- .../mobile/app/controller/Main.js | 12 +++--- .../mobile/app/controller/Settings.js | 2 +- .../mobile/app/view/add/AddOther.js | 2 +- .../main/app/controller/DocumentHolder.js | 2 +- .../main/app/controller/Main.js | 16 ++++---- .../main/app/view/FileMenuPanels.js | 2 +- .../main/app/view/FormatRulesManagerDlg.js | 2 +- .../main/app/view/NameManagerDlg.js | 2 +- .../main/app/view/ViewManagerDlg.js | 2 +- .../mobile/app/controller/Main.js | 12 +++--- .../mobile/app/controller/Settings.js | 2 +- .../mobile/app/view/add/AddOther.js | 2 +- 32 files changed, 102 insertions(+), 102 deletions(-) diff --git a/apps/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js index d6b3e56ee..a51a2ee13 100644 --- a/apps/common/main/lib/controller/Comments.js +++ b/apps/common/main/lib/controller/Comments.js @@ -216,7 +216,7 @@ define([ comment.asc_putTime(this.utcDateToString(new Date())); comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date())); comment.asc_putUserId(this.currentUserId); - comment.asc_putUserName(Common.Utils.UserInfoParser.getCurrentName()); + comment.asc_putUserName(AscCommon.UserInfoParser.getCurrentName()); comment.asc_putSolved(false); if (!_.isUndefined(comment.asc_putDocumentFlag)) { @@ -354,7 +354,7 @@ define([ ascComment.asc_putTime(t.utcDateToString(new Date(comment.get('time')))); ascComment.asc_putOnlyOfficeTime(t.ooDateToString(new Date(comment.get('time')))); ascComment.asc_putUserId(t.currentUserId); - ascComment.asc_putUserName(Common.Utils.UserInfoParser.getCurrentName()); + ascComment.asc_putUserName(AscCommon.UserInfoParser.getCurrentName()); ascComment.asc_putSolved(comment.get('resolved')); ascComment.asc_putGuid(comment.get('guid')); ascComment.asc_putUserData(comment.get('userdata')); @@ -431,7 +431,7 @@ define([ if (reply.get('id') === replyId && !_.isUndefined(replyVal)) { addReply.asc_putText(replyVal); addReply.asc_putUserId(me.currentUserId); - addReply.asc_putUserName(Common.Utils.UserInfoParser.getCurrentName()); + addReply.asc_putUserName(AscCommon.UserInfoParser.getCurrentName()); } else { addReply.asc_putText(reply.get('reply')); addReply.asc_putUserId(reply.get('userid')); @@ -511,7 +511,7 @@ define([ addReply.asc_putTime(me.utcDateToString(new Date())); addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date())); addReply.asc_putUserId(me.currentUserId); - addReply.asc_putUserName(Common.Utils.UserInfoParser.getCurrentName()); + addReply.asc_putUserName(AscCommon.UserInfoParser.getCurrentName()); ascComment.asc_addReply(addReply); @@ -776,9 +776,9 @@ define([ comment.set('userdata', data.asc_getUserData()); comment.set('time', date.getTime()); comment.set('date', t.dateToLocaleTimeString(date)); - comment.set('editable', (t.mode.canEditComments || (data.asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getUserName())); - comment.set('removable', (t.mode.canDeleteComments || (data.asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getUserName())); - comment.set('hide', !Common.Utils.UserInfoParser.canViewComment(data.asc_getUserName())); + comment.set('editable', (t.mode.canEditComments || (data.asc_getUserId() == t.currentUserId)) && AscCommon.UserInfoParser.canEditComment(data.asc_getUserName())); + comment.set('removable', (t.mode.canDeleteComments || (data.asc_getUserId() == t.currentUserId)) && AscCommon.UserInfoParser.canDeleteComment(data.asc_getUserName())); + comment.set('hide', !AscCommon.UserInfoParser.canViewComment(data.asc_getUserName())); replies = _.clone(comment.get('replys')); @@ -804,9 +804,9 @@ define([ editTextInPopover : false, showReplyInPopover : false, scope : t.view, - editable : (t.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getReply(i).asc_getUserName()), - removable : (t.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName()), - hide : !Common.Utils.UserInfoParser.canViewComment(data.asc_getReply(i).asc_getUserName()) + editable : (t.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)) && AscCommon.UserInfoParser.canEditComment(data.asc_getReply(i).asc_getUserName()), + removable : (t.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)) && AscCommon.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName()), + hide : !AscCommon.UserInfoParser.canViewComment(data.asc_getReply(i).asc_getUserName()) })); } @@ -1255,9 +1255,9 @@ define([ showReplyInPopover : false, hideAddReply : !_.isUndefined(this.hidereply) ? this.hidereply : (this.showPopover ? true : false), scope : this.view, - editable : (this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getUserName()), - removable : (this.mode.canDeleteComments || (data.asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getUserName()), - hide : !Common.Utils.UserInfoParser.canViewComment(data.asc_getUserName()), + editable : (this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId)) && AscCommon.UserInfoParser.canEditComment(data.asc_getUserName()), + removable : (this.mode.canDeleteComments || (data.asc_getUserId() == this.currentUserId)) && AscCommon.UserInfoParser.canDeleteComment(data.asc_getUserName()), + hide : !AscCommon.UserInfoParser.canViewComment(data.asc_getUserName()), hint : !this.mode.canComments, groupName : (groupname && groupname.length>1) ? groupname[1] : null }); @@ -1294,9 +1294,9 @@ define([ editTextInPopover : false, showReplyInPopover : false, scope : this.view, - editable : (this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getReply(i).asc_getUserName()), - removable : (this.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName()), - hide : !Common.Utils.UserInfoParser.canViewComment(data.asc_getReply(i).asc_getUserName()) + editable : (this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)) && AscCommon.UserInfoParser.canEditComment(data.asc_getReply(i).asc_getUserName()), + removable : (this.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)) && AscCommon.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName()), + hide : !AscCommon.UserInfoParser.canViewComment(data.asc_getReply(i).asc_getUserName()) })); } } @@ -1326,7 +1326,7 @@ define([ time: date.getTime(), date: this.dateToLocaleTimeString(date), userid: this.currentUserId, - username: Common.Utils.UserInfoParser.getCurrentName(), + username: AscCommon.UserInfoParser.getCurrentName(), usercolor: (user) ? user.get('color') : null, editTextInPopover: true, showReplyInPopover: false, @@ -1390,7 +1390,7 @@ define([ comment.asc_putTime(this.utcDateToString(new Date())); comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date())); comment.asc_putUserId(this.currentUserId); - comment.asc_putUserName(Common.Utils.UserInfoParser.getCurrentName()); + comment.asc_putUserName(AscCommon.UserInfoParser.getCurrentName()); comment.asc_putSolved(false); if (!_.isUndefined(comment.asc_putDocumentFlag)) @@ -1457,7 +1457,7 @@ define([ for (i = 0; i < comments.length; ++i) { comment = this.findComment(comments[i].asc_getId()); if (comment) { - comment.set('editTextInPopover', t.mode.canEditComments && Common.Utils.UserInfoParser.canEditComment(comment.username));// dont't edit comment when customization->commentAuthorOnly is true or when permissions.editCommentAuthorOnly is true + comment.set('editTextInPopover', t.mode.canEditComments && AscCommon.UserInfoParser.canEditComment(comment.username));// dont't edit comment when customization->commentAuthorOnly is true or when permissions.editCommentAuthorOnly is true comment.set('hint', false); this.popoverComments.push(comment); } diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 87070b0ea..379141994 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -464,7 +464,7 @@ define([ scope : me.view, hint : !me.appConfig.canReview, goto : (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom), - editable : me.appConfig.isReviewOnly && (item.get_UserId() == me.currentUserId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || Common.Utils.UserInfoParser.canEditReview(item.get_UserName())) + editable : me.appConfig.isReviewOnly && (item.get_UserId() == me.currentUserId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || AscCommon.UserInfoParser.canEditReview(item.get_UserName())) }); arr.push(change); @@ -475,7 +475,7 @@ define([ getUserName: function(id){ if (this.userCollection && id!==null){ var rec = this.userCollection.findUser(id); - if (rec) return Common.Utils.UserInfoParser.getParsedName(rec.get('username')); + if (rec) return AscCommon.UserInfoParser.getParsedName(rec.get('username')); } return ''; }, @@ -576,7 +576,7 @@ define([ this.view.turnChanges(state, global); if (userId && this.userCollection) { var rec = this.userCollection.findOriginalUser(userId); - rec && this.showTips(Common.Utils.String.format(globalFlag ? this.textOnGlobal : this.textOffGlobal, Common.Utils.UserInfoParser.getParsedName(rec.get('username')))); + rec && this.showTips(Common.Utils.String.format(globalFlag ? this.textOnGlobal : this.textOffGlobal, AscCommon.UserInfoParser.getParsedName(rec.get('username')))); } } }, diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 56df35ac8..338d4bdf5 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -724,7 +724,7 @@ Common.Utils.fillUserInfo = function(info, lang, defname) { var _user = info || {}; !_user.id && (_user.id = ('uid-' + Date.now())); _user.fullname = _.isEmpty(_user.name) ? defname : _user.name; - _user.group && (_user.fullname = (_user.group).toString() + Common.Utils.UserInfoParser.getSeparator() + _user.fullname); + _user.group && (_user.fullname = (_user.group).toString() + AscCommon.UserInfoParser.getSeparator() + _user.fullname); _user.guest = _.isEmpty(_user.name); return _user; }; diff --git a/apps/common/main/lib/view/Chat.js b/apps/common/main/lib/view/Chat.js index c4ca52921..f001786df 100644 --- a/apps/common/main/lib/view/Chat.js +++ b/apps/common/main/lib/view/Chat.js @@ -267,7 +267,7 @@ define([ }, getUserName: function (username) { - return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username)); + return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)); }, hide: function () { diff --git a/apps/common/main/lib/view/Comments.js b/apps/common/main/lib/view/Comments.js index bc5bc47f1..08ae2ba90 100644 --- a/apps/common/main/lib/view/Comments.js +++ b/apps/common/main/lib/view/Comments.js @@ -664,7 +664,7 @@ define([ return Common.Utils.String.ellipsis(Common.Utils.String.htmlEncode(quote), 120, true); }, getUserName: function (username) { - return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username)); + return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)); }, pickLink: function (message) { diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index 85bb1a407..2f19f13b4 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -136,7 +136,7 @@ define([ users: collection.chain().filter(function(item){return item.get('online') && !item.get('view')}).groupBy(function(item) {return item.get('idOriginal');}).value(), usertpl: _.template(templateUserItem), fnEncode: function(username) { - return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username)); + return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)); } })); diff --git a/apps/common/main/lib/view/History.js b/apps/common/main/lib/view/History.js index eebdb45f2..28f75ff4d 100644 --- a/apps/common/main/lib/view/History.js +++ b/apps/common/main/lib/view/History.js @@ -90,7 +90,7 @@ define([ '<% } %>', '
    ', '
    ', - '
    <%= Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username)) %>', + '
    <%= Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)) %>', '', '<% if (canRestore && selected) { %>', '', diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index 6d26b4bdf..63ae72f2f 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -670,7 +670,7 @@ define([ }, getUserName: function (username) { - return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username)); + return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)); }, turnChanges: function(state, global) { diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index a178df72f..ba6ca9728 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -255,7 +255,7 @@ define([ var me = this; var usersArray = []; _.each(editUsers, function(item){ - var name = Common.Utils.UserInfoParser.getParsedName(item.asc_getUserName()); + var name = AscCommon.UserInfoParser.getParsedName(item.asc_getUserName()); var initials = me.getInitials(name); if((item.asc_getState()!==false) && !item.asc_getView()) { var userAttr = { @@ -699,7 +699,7 @@ define([ userColor = item.get_UserColor(), goto = (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom); date = me.dateToLocaleTimeString(date); - var editable = me.appConfig.isReviewOnly && (item.get_UserId() == _userId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || Common.Utils.UserInfoParser.canEditReview(item.get_UserName())); + var editable = me.appConfig.isReviewOnly && (item.get_UserId() == _userId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || AscCommon.UserInfoParser.canEditReview(item.get_UserName())); arr.push({date: date, user: user, usercolor: userColor, changetext: changetext, goto: goto, editable: editable}); }); arrChangeReview = arr; @@ -770,7 +770,7 @@ define([ }, getInitials: function(name) { - var fio = Common.Utils.UserInfoParser.getParsedName(name).split(' '); + var fio = AscCommon.UserInfoParser.getParsedName(name).split(' '); var initials = fio[0].substring(0, 1).toUpperCase(); for (var i=fio.length-1; i>0; i--) { if (fio[i][0]!=='(' && fio[i][0]!==')') { @@ -1558,9 +1558,9 @@ define([ reply : data.asc_getReply(i).asc_getText(), time : date.getTime(), userInitials : this.getInitials(username), - editable : (this.appConfig.canEditComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canEditComment(username), - removable : (this.appConfig.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(username), - hide : !Common.Utils.UserInfoParser.canViewComment(data.asc_getReply(i).asc_getUserName()) + editable : (this.appConfig.canEditComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && AscCommon.UserInfoParser.canEditComment(username), + removable : (this.appConfig.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && AscCommon.UserInfoParser.canDeleteComment(username), + hide : !AscCommon.UserInfoParser.canViewComment(data.asc_getReply(i).asc_getUserName()) }); } } @@ -1589,9 +1589,9 @@ define([ replys : [], groupName : (groupname && groupname.length>1) ? groupname[1] : null, userInitials : this.getInitials(username), - editable : (this.appConfig.canEditComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canEditComment(username), - removable : (this.appConfig.canDeleteComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(username), - hide : !Common.Utils.UserInfoParser.canViewComment(username) + editable : (this.appConfig.canEditComments || (data.asc_getUserId() == _userId)) && AscCommon.UserInfoParser.canEditComment(username), + removable : (this.appConfig.canDeleteComments || (data.asc_getUserId() == _userId)) && AscCommon.UserInfoParser.canDeleteComment(username), + hide : !AscCommon.UserInfoParser.canViewComment(username) }; if (comment) { var replies = this.readSDKReplies(data); @@ -1627,9 +1627,9 @@ define([ comment.quote = data.asc_getQuoteText(); comment.time = date.getTime(); comment.date = me.dateToLocaleTimeString(date); - comment.editable = (me.appConfig.canEditComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canEditComment(data.asc_getUserName()); - comment.removable = (me.appConfig.canDeleteComments || (data.asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(data.asc_getUserName()); - comment.hide = !Common.Utils.UserInfoParser.canViewComment(data.asc_getUserName()); + comment.editable = (me.appConfig.canEditComments || (data.asc_getUserId() == _userId)) && AscCommon.UserInfoParser.canEditComment(data.asc_getUserName()); + comment.removable = (me.appConfig.canDeleteComments || (data.asc_getUserId() == _userId)) && AscCommon.UserInfoParser.canDeleteComment(data.asc_getUserName()); + comment.hide = !AscCommon.UserInfoParser.canViewComment(data.asc_getUserName()); replies = _.clone(comment.replys); @@ -1654,9 +1654,9 @@ define([ reply : data.asc_getReply(i).asc_getText(), time : dateReply.getTime(), userInitials : me.getInitials(username), - editable : (me.appConfig.canEditComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canEditComment(username), - removable : (me.appConfig.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && Common.Utils.UserInfoParser.canDeleteComment(username), - hide : !Common.Utils.UserInfoParser.canViewComment(username) + editable : (me.appConfig.canEditComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && AscCommon.UserInfoParser.canEditComment(username), + removable : (me.appConfig.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == _userId)) && AscCommon.UserInfoParser.canDeleteComment(username), + hide : !AscCommon.UserInfoParser.canViewComment(username) }); } comment.replys = replies; diff --git a/apps/common/mobile/lib/view/Collaboration.js b/apps/common/mobile/lib/view/Collaboration.js index edf0137d9..34c065766 100644 --- a/apps/common/mobile/lib/view/Collaboration.js +++ b/apps/common/mobile/lib/view/Collaboration.js @@ -462,7 +462,7 @@ define([ }, getUserName: function (username) { - return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username)); + return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)); }, textCollaboration: 'Collaboration', diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 8737b4c79..7e8aff8c9 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1334,11 +1334,11 @@ define([ this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroups || this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object')); this.appOptions.canUseCommentPermissions = this.appOptions.canLicense && !!this.permissions.commentGroups; - Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions || this.appOptions.canUseCommentPermissions); - Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname); - this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions); - this.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(this.permissions.commentGroups); - appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName())); + AscCommon.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions || this.appOptions.canUseCommentPermissions); + AscCommon.UserInfoParser.setCurrentName(this.appOptions.user.fullname); + this.appOptions.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions); + this.appOptions.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(this.permissions.commentGroups); + appHeader.setUserName(AscCommon.UserInfoParser.getParsedName(AscCommon.UserInfoParser.getCurrentName())); this.appOptions.canRename && appHeader.setCanRename(true); this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); @@ -2234,10 +2234,10 @@ define([ onUserConnection: function(change){ if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (change.asc_getIdOriginal() == this.appOptions.user.id)) { // change name of the current user var name = change.asc_getUserName(); - if (name && name !== Common.Utils.UserInfoParser.getCurrentName() ) { + if (name && name !== AscCommon.UserInfoParser.getCurrentName() ) { this._renameDialog && this._renameDialog.close(); - Common.Utils.UserInfoParser.setCurrentName(name); - appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(name)); + AscCommon.UserInfoParser.setCurrentName(name); + appHeader.setUserName(AscCommon.UserInfoParser.getParsedName(name)); var idx1 = name.lastIndexOf('('), idx2 = name.lastIndexOf(')'), diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index ae8bd17d0..0c4457bb5 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -359,7 +359,7 @@ define([ if (usersStore){ var rec = usersStore.findUser(id); if (rec) - return Common.Utils.UserInfoParser.getParsedName(rec.get('username')); + return AscCommon.UserInfoParser.getParsedName(rec.get('username')); } return me.guestText; }; diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 757772616..865fc8e59 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -1206,7 +1206,7 @@ define([ visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible; value = props.asc_getLastModifiedBy(); if (value) - this.lblModifyBy.text(Common.Utils.UserInfoParser.getParsedName(value)); + this.lblModifyBy.text(AscCommon.UserInfoParser.getParsedName(value)); visible = this._ShowHideInfoItem(this.lblModifyBy, !!value) || visible; $('tr.divider.modify', this.el)[visible?'show':'hide'](); diff --git a/apps/documenteditor/mobile/app/controller/DocumentHolder.js b/apps/documenteditor/mobile/app/controller/DocumentHolder.js index ba841b843..772810169 100644 --- a/apps/documenteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/documenteditor/mobile/app/controller/DocumentHolder.js @@ -355,7 +355,7 @@ define([ if (usersStore){ var rec = usersStore.findUser(id); if (rec) - return Common.Utils.UserInfoParser.getParsedName(rec.get('username')); + return AscCommon.UserInfoParser.getParsedName(rec.get('username')); } return me.textGuest; }; diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index b056ea509..f8a1f7e36 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -840,10 +840,10 @@ define([ me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && (!!me.permissions.reviewGroups || me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object')); me.appOptions.canUseCommentPermissions = me.appOptions.canLicense && !!me.permissions.commentGroups; - Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions || me.appOptions.canUseCommentPermissions); - Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname); - me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.permissions.reviewGroups, me.editorConfig.customization.reviewPermissions); - me.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(me.permissions.commentGroups); + AscCommon.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions || me.appOptions.canUseCommentPermissions); + AscCommon.UserInfoParser.setCurrentName(me.appOptions.user.fullname); + me.appOptions.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(me.permissions.reviewGroups, me.editorConfig.customization.reviewPermissions); + me.appOptions.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(me.permissions.commentGroups); me.applyModeCommonElements(); me.applyModeEditorElements(); @@ -1388,8 +1388,8 @@ define([ onUserConnection: function(change){ if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (change.asc_getIdOriginal() == this.appOptions.user.id)) { // change name of the current user var name = change.asc_getUserName(); - if (name && name !== Common.Utils.UserInfoParser.getCurrentName() ) { - Common.Utils.UserInfoParser.setCurrentName(name); + if (name && name !== AscCommon.UserInfoParser.getCurrentName() ) { + AscCommon.UserInfoParser.setCurrentName(name); } } }, diff --git a/apps/documenteditor/mobile/app/controller/Settings.js b/apps/documenteditor/mobile/app/controller/Settings.js index e1c6ea319..56075a122 100644 --- a/apps/documenteditor/mobile/app/controller/Settings.js +++ b/apps/documenteditor/mobile/app/controller/Settings.js @@ -458,7 +458,7 @@ define([ value = props.asc_getModified(); value ? $('#settings-doc-last-mod').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleTimeString(_lang, {timeStyle: 'short'})) : $('.display-last-mode').remove(); value = props.asc_getLastModifiedBy(); - value ? $('#settings-doc-mod-by').html(Common.Utils.UserInfoParser.getParsedName(value)) : $('.display-mode-by').remove(); + value ? $('#settings-doc-mod-by').html(AscCommon.UserInfoParser.getParsedName(value)) : $('.display-mode-by').remove(); value = props.asc_getCreated(); value ? $('#settings-doc-date').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleTimeString(_lang, {timeStyle: 'short'})) : $('.display-created-date').remove(); value = props.asc_getCreator(); diff --git a/apps/documenteditor/mobile/app/view/add/AddOther.js b/apps/documenteditor/mobile/app/view/add/AddOther.js index d551fd515..1bcb327e4 100644 --- a/apps/documenteditor/mobile/app/view/add/AddOther.js +++ b/apps/documenteditor/mobile/app/view/add/AddOther.js @@ -209,7 +209,7 @@ define([ }, getUserName: function (username) { - return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username)); + return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)); }, renderNumFormat: function (dataFormat, selectFormat) { diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 3be23c570..bbf8b0316 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1035,11 +1035,11 @@ define([ this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroups || this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object')); this.appOptions.canUseCommentPermissions = this.appOptions.canLicense && !!this.permissions.commentGroups; - Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions || this.appOptions.canUseCommentPermissions); - Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname); - this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions); - this.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(this.permissions.commentGroups); - appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName())); + AscCommon.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions || this.appOptions.canUseCommentPermissions); + AscCommon.UserInfoParser.setCurrentName(this.appOptions.user.fullname); + this.appOptions.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions); + this.appOptions.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(this.permissions.commentGroups); + appHeader.setUserName(AscCommon.UserInfoParser.getParsedName(AscCommon.UserInfoParser.getCurrentName())); this.appOptions.canRename && appHeader.setCanRename(true); this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); @@ -1880,10 +1880,10 @@ define([ onUserConnection: function(change){ if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (change.asc_getIdOriginal() == this.appOptions.user.id)) { // change name of the current user var name = change.asc_getUserName(); - if (name && name !== Common.Utils.UserInfoParser.getCurrentName() ) { + if (name && name !== AscCommon.UserInfoParser.getCurrentName() ) { this._renameDialog && this._renameDialog.close(); - Common.Utils.UserInfoParser.setCurrentName(name); - appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(name)); + AscCommon.UserInfoParser.setCurrentName(name); + appHeader.setUserName(AscCommon.UserInfoParser.getParsedName(name)); var idx1 = name.lastIndexOf('('), idx2 = name.lastIndexOf(')'), diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index f0d3a45bb..2801f7839 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -363,7 +363,7 @@ define([ if (usersStore){ var rec = usersStore.findUser(id); if (rec) - return Common.Utils.UserInfoParser.getParsedName(rec.get('username')); + return AscCommon.UserInfoParser.getParsedName(rec.get('username')); } return me.guestText; }; diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index d11a5047d..cae577509 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -1074,7 +1074,7 @@ define([ visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible; value = props.asc_getLastModifiedBy(); if (value) - this.lblModifyBy.text(Common.Utils.UserInfoParser.getParsedName(value)); + this.lblModifyBy.text(AscCommon.UserInfoParser.getParsedName(value)); visible = this._ShowHideInfoItem(this.lblModifyBy, !!value) || visible; $('tr.divider.modify', this.el)[visible?'show':'hide'](); diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index a0d15686f..75d52240f 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -763,10 +763,10 @@ define([ me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && (!!me.permissions.reviewGroups || me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object')); me.appOptions.canUseCommentPermissions = me.appOptions.canLicense && !!me.permissions.commentGroups; - Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions || me.appOptions.canUseCommentPermissions); - Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname); - me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.permissions.reviewGroups, me.editorConfig.customization.reviewPermissions); - me.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(me.permissions.commentGroups); + AscCommon.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions || me.appOptions.canUseCommentPermissions); + AscCommon.UserInfoParser.setCurrentName(me.appOptions.user.fullname); + me.appOptions.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(me.permissions.reviewGroups, me.editorConfig.customization.reviewPermissions); + me.appOptions.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(me.permissions.commentGroups); me.applyModeCommonElements(); me.applyModeEditorElements(); @@ -1278,8 +1278,8 @@ define([ onUserConnection: function(change){ if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (change.asc_getIdOriginal() == this.appOptions.user.id)) { // change name of the current user var name = change.asc_getUserName(); - if (name && name !== Common.Utils.UserInfoParser.getCurrentName() ) { - Common.Utils.UserInfoParser.setCurrentName(name); + if (name && name !== AscCommon.UserInfoParser.getCurrentName() ) { + AscCommon.UserInfoParser.setCurrentName(name); } } }, diff --git a/apps/presentationeditor/mobile/app/controller/Settings.js b/apps/presentationeditor/mobile/app/controller/Settings.js index f79b3057c..ea0a505de 100644 --- a/apps/presentationeditor/mobile/app/controller/Settings.js +++ b/apps/presentationeditor/mobile/app/controller/Settings.js @@ -239,7 +239,7 @@ define([ value = props.asc_getModified(); value ? $('#settings-pe-last-mod').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleTimeString(_lang, {timeStyle: 'short'})) : $('.display-last-mode').remove(); value = props.asc_getLastModifiedBy(); - value ? $('#settings-pe-mod-by').html(Common.Utils.UserInfoParser.getParsedName(value)) : $('.display-mode-by').remove(); + value ? $('#settings-pe-mod-by').html(AscCommon.UserInfoParser.getParsedName(value)) : $('.display-mode-by').remove(); value = props.asc_getCreated(); value ? $('#settings-pe-date').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleTimeString(_lang, {timeStyle: 'short'})) : $('.display-created-date').remove(); value = props.asc_getCreator(); diff --git a/apps/presentationeditor/mobile/app/view/add/AddOther.js b/apps/presentationeditor/mobile/app/view/add/AddOther.js index cb2eaa178..f50287c93 100644 --- a/apps/presentationeditor/mobile/app/view/add/AddOther.js +++ b/apps/presentationeditor/mobile/app/view/add/AddOther.js @@ -175,7 +175,7 @@ define([ }, getUserName: function (username) { - return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username)); + return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)); }, showPageTable: function() { diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index d40201c40..47ffa2cf7 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -1088,7 +1088,7 @@ define([ if (usersStore){ var rec = usersStore.findUser(id); if (rec) - return Common.Utils.UserInfoParser.getParsedName(rec.get('username')); + return AscCommon.UserInfoParser.getParsedName(rec.get('username')); } return me.guestText; }; diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index f38c0003a..d8a916fe8 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1082,11 +1082,11 @@ define([ this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroups || this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object')); this.appOptions.canUseCommentPermissions = this.appOptions.canLicense && !!this.permissions.commentGroups; - Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions || this.appOptions.canUseCommentPermissions); - Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname); - this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions); - this.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(this.permissions.commentGroups); - this.headerView.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName())); + AscCommon.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions || this.appOptions.canUseCommentPermissions); + AscCommon.UserInfoParser.setCurrentName(this.appOptions.user.fullname); + this.appOptions.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions); + this.appOptions.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(this.permissions.commentGroups); + this.headerView.setUserName(AscCommon.UserInfoParser.getParsedName(AscCommon.UserInfoParser.getCurrentName())); } else this.appOptions.canModifyFilter = true; @@ -2267,10 +2267,10 @@ define([ onUserConnection: function(change){ if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (change.asc_getIdOriginal() == this.appOptions.user.id)) { // change name of the current user var name = change.asc_getUserName(); - if (name && name !== Common.Utils.UserInfoParser.getCurrentName() ) { + if (name && name !== AscCommon.UserInfoParser.getCurrentName() ) { this._renameDialog && this._renameDialog.close(); - Common.Utils.UserInfoParser.setCurrentName(name); - this.headerView.setUserName(Common.Utils.UserInfoParser.getParsedName(name)); + AscCommon.UserInfoParser.setCurrentName(name); + this.headerView.setUserName(AscCommon.UserInfoParser.getParsedName(name)); var idx1 = name.lastIndexOf('('), idx2 = name.lastIndexOf(')'), diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 6223b070f..34da0709c 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -1932,7 +1932,7 @@ define([ visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible; value = props.asc_getLastModifiedBy(); if (value) - this.lblModifyBy.text(Common.Utils.UserInfoParser.getParsedName(value)); + this.lblModifyBy.text(AscCommon.UserInfoParser.getParsedName(value)); visible = this._ShowHideInfoItem(this.lblModifyBy, !!value) || visible; $('tr.divider.modify', this.el)[visible?'show':'hide'](); diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index 90ee62f46..32307ddd2 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -822,7 +822,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa if (usersStore){ var rec = usersStore.findUser(id); if (rec) - return Common.Utils.UserInfoParser.getParsedName(rec.get('username')); + return AscCommon.UserInfoParser.getParsedName(rec.get('username')); } return this.guestText; }, diff --git a/apps/spreadsheeteditor/main/app/view/NameManagerDlg.js b/apps/spreadsheeteditor/main/app/view/NameManagerDlg.js index 9229ea8d9..ee0269127 100644 --- a/apps/spreadsheeteditor/main/app/view/NameManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/NameManagerDlg.js @@ -381,7 +381,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template', if (usersStore){ var rec = usersStore.findUser(id); if (rec) - return Common.Utils.UserInfoParser.getParsedName(rec.get('username')); + return AscCommon.UserInfoParser.getParsedName(rec.get('username')); } return this.guestText; }, diff --git a/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js b/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js index d41d1b08b..caef82b3b 100644 --- a/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js @@ -300,7 +300,7 @@ define([ if (usersStore){ var rec = usersStore.findUser(id); if (rec) - return Common.Utils.UserInfoParser.getParsedName(rec.get('username')); + return AscCommon.UserInfoParser.getParsedName(rec.get('username')); } return this.guestText; }, diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 50fbab3e1..4daa9d0d4 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -775,10 +775,10 @@ define([ me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && (!!me.permissions.reviewGroups || me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object')); me.appOptions.canUseCommentPermissions = me.appOptions.canLicense && !!me.permissions.commentGroups; - Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions || me.appOptions.canUseCommentPermissions); - Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname); - me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.permissions.reviewGroups, me.editorConfig.customization.reviewPermissions); - me.appOptions.canUseCommentPermissions && Common.Utils.UserInfoParser.setCommentPermissions(me.permissions.commentGroups); + AscCommon.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions || me.appOptions.canUseCommentPermissions); + AscCommon.UserInfoParser.setCurrentName(me.appOptions.user.fullname); + me.appOptions.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(me.permissions.reviewGroups, me.editorConfig.customization.reviewPermissions); + me.appOptions.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(me.permissions.commentGroups); } me.appOptions.canRequestEditRights = me.editorConfig.canRequestEditRights; @@ -1483,8 +1483,8 @@ define([ onUserConnection: function(change){ if (change && this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (change.asc_getIdOriginal() == this.appOptions.user.id)) { // change name of the current user var name = change.asc_getUserName(); - if (name && name !== Common.Utils.UserInfoParser.getCurrentName() ) { - Common.Utils.UserInfoParser.setCurrentName(name); + if (name && name !== AscCommon.UserInfoParser.getCurrentName() ) { + AscCommon.UserInfoParser.setCurrentName(name); } } }, diff --git a/apps/spreadsheeteditor/mobile/app/controller/Settings.js b/apps/spreadsheeteditor/mobile/app/controller/Settings.js index 05318621a..e9440fc26 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Settings.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Settings.js @@ -306,7 +306,7 @@ define([ value = props.asc_getModified(); value ? $('#settings-sse-last-mod').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleTimeString(_lang, {timeStyle: 'short'})) : $('.display-last-mode').remove(); value = props.asc_getLastModifiedBy(); - value ? $('#settings-sse-mod-by').html(Common.Utils.UserInfoParser.getParsedName(value)) : $('.display-mode-by').remove(); + value ? $('#settings-sse-mod-by').html(AscCommon.UserInfoParser.getParsedName(value)) : $('.display-mode-by').remove(); value = props.asc_getCreated(); value ? $('#settings-sse-date').html(value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleTimeString(_lang, {timeStyle: 'short'})) : $('.display-created-date').remove(); value = props.asc_getCreator(); diff --git a/apps/spreadsheeteditor/mobile/app/view/add/AddOther.js b/apps/spreadsheeteditor/mobile/app/view/add/AddOther.js index 4cc905e0f..eea9b79b5 100644 --- a/apps/spreadsheeteditor/mobile/app/view/add/AddOther.js +++ b/apps/spreadsheeteditor/mobile/app/view/add/AddOther.js @@ -249,7 +249,7 @@ define([ }, getUserName: function (username) { - return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(username)); + return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)); }, showInsertImage: function () {