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