[DE] Hide user names if their comments or reviews cannot be edited
This commit is contained in:
parent
cb0547b09b
commit
5bb89a54ea
|
@ -64,10 +64,18 @@ define([
|
|||
return this.filter(function(item){return item.get('online') && !item.get('view')}).length;
|
||||
},
|
||||
|
||||
getVisibleEditingCount: function() {
|
||||
return this.filter(function(item){return item.get('online') && !item.get('view') && !item.get('hidden')}).length;
|
||||
},
|
||||
|
||||
getEditingOriginalCount: function() {
|
||||
return this.chain().filter(function(item){return item.get('online') && !item.get('view')}).groupBy(function(item) {return item.get('idOriginal');}).size().value();
|
||||
},
|
||||
|
||||
getVisibleEditingOriginalCount: function() {
|
||||
return this.chain().filter(function(item){return item.get('online') && !item.get('view') && !item.get('hidden')}).groupBy(function(item) {return item.get('idOriginal');}).size().value();
|
||||
},
|
||||
|
||||
findUser: function(id) {
|
||||
return this.find(
|
||||
function(model){
|
||||
|
|
|
@ -89,6 +89,7 @@ define([
|
|||
|
||||
setMode: function(mode) {
|
||||
this.mode = mode;
|
||||
this.currentUserId = mode.user.id;
|
||||
|
||||
if (this.api) {
|
||||
if (this.mode.canCoAuthoring && this.mode.canChat)
|
||||
|
@ -142,7 +143,8 @@ define([
|
|||
username : user.asc_getUserName(),
|
||||
online : true,
|
||||
color : user.asc_getColor(),
|
||||
view : user.asc_getView()
|
||||
view : user.asc_getView(),
|
||||
hidden : !(user.asc_getIdOriginal()===this.currentUserId || AscCommon.UserInfoParser.isUserVisible(user.asc_getUserName()))
|
||||
});
|
||||
arrUsers[(user.asc_getId() == currentUserId ) ? 'unshift' : 'push'](usermodel);
|
||||
}
|
||||
|
@ -165,7 +167,8 @@ define([
|
|||
username : change.asc_getUserName(),
|
||||
online : change.asc_getState(),
|
||||
color : change.asc_getColor(),
|
||||
view : change.asc_getView()
|
||||
view : change.asc_getView(),
|
||||
hidden : !(change.asc_getIdOriginal()===this.currentUserId || AscCommon.UserInfoParser.isUserVisible(change.asc_getUserName()))
|
||||
}));
|
||||
} else {
|
||||
user.set({online: change.asc_getState()});
|
||||
|
|
|
@ -62,7 +62,8 @@ define([
|
|||
color : '#fff',
|
||||
colorval : null,
|
||||
online : false,
|
||||
view : false
|
||||
view : false,
|
||||
hidden : false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -130,11 +130,11 @@ define([
|
|||
'</section>';
|
||||
|
||||
function onResetUsers(collection, opts) {
|
||||
var usercount = collection.getEditingCount();
|
||||
var usercount = collection.getVisibleEditingCount();
|
||||
if ( $userList ) {
|
||||
if ( usercount > 1 || usercount > 0 && appConfig && !appConfig.isEdit && !appConfig.isRestrictedEdit) {
|
||||
$userList.html(templateUserList({
|
||||
users: collection.chain().filter(function(item){return item.get('online') && !item.get('view')}).groupBy(function(item) {return item.get('idOriginal');}).value(),
|
||||
users: collection.chain().filter(function(item){return item.get('online') && !item.get('view') && !item.get('hidden')}).groupBy(function(item) {return item.get('idOriginal');}).value(),
|
||||
usertpl: _.template(templateUserItem),
|
||||
fnEncode: function(username) {
|
||||
return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username));
|
||||
|
@ -153,7 +153,7 @@ define([
|
|||
}
|
||||
}
|
||||
|
||||
applyUsers( usercount, collection.getEditingOriginalCount() );
|
||||
applyUsers( usercount, collection.getVisibleEditingOriginalCount() );
|
||||
};
|
||||
|
||||
function onUsersChanged(model) {
|
||||
|
@ -270,7 +270,7 @@ define([
|
|||
$panelUsers.find('.cousers-menu')
|
||||
.on('click', function(e) { return false; });
|
||||
|
||||
var editingUsers = storeUsers.getEditingCount();
|
||||
var editingUsers = storeUsers.getVisibleEditingCount();
|
||||
$btnUsers.tooltip({
|
||||
title: (editingUsers > 1 || editingUsers>0 && !appConfig.isEdit && !appConfig.isRestrictedEdit) ? me.tipViewUsers : me.tipAccessRights,
|
||||
titleNorm: me.tipAccessRights,
|
||||
|
|
|
@ -366,6 +366,14 @@ define([
|
|||
}
|
||||
return me.guestText;
|
||||
};
|
||||
var isUserVisible = function(id){
|
||||
if (usersStore){
|
||||
var rec = usersStore.findUser(id);
|
||||
if (rec)
|
||||
return !rec.get('hidden');
|
||||
}
|
||||
return true;
|
||||
};
|
||||
/** coauthoring end **/
|
||||
|
||||
|
||||
|
@ -577,7 +585,7 @@ define([
|
|||
screenTip.toolTip.getBSTip().$tip.css({top: showPoint[1] + 'px', left: showPoint[0] + 'px'});
|
||||
}
|
||||
/** coauthoring begin **/
|
||||
else if (moveData.get_Type()==Asc.c_oAscMouseMoveDataTypes.LockedObject && me.mode.isEdit) { // 2 - locked object
|
||||
else if (moveData.get_Type()==Asc.c_oAscMouseMoveDataTypes.LockedObject && me.mode.isEdit && isUserVisible(moveData.get_UserId())) { // 2 - locked object
|
||||
var src;
|
||||
if (me.usertipcount >= me.usertips.length) {
|
||||
src = $(document.createElement("div"));
|
||||
|
@ -613,6 +621,8 @@ define([
|
|||
};
|
||||
|
||||
var onShowForeignCursorLabel = function(UserId, X, Y, color) {
|
||||
if (!isUserVisible(UserId)) return;
|
||||
|
||||
/** coauthoring begin **/
|
||||
var src;
|
||||
for (var i=0; i<me.fastcoauthtips.length; i++) {
|
||||
|
|
Loading…
Reference in a new issue