[DE mobile] Refactoring review permissions

This commit is contained in:
Julia Radzhabova 2021-03-16 20:17:35 +03:00
parent 7cc14b5f26
commit 5a373f76bb

View file

@ -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,