[PE][SSE] Hide user names if their comments or reviews cannot be edited

This commit is contained in:
Julia Radzhabova 2021-11-09 01:01:49 +03:00
parent 5bb89a54ea
commit cf42a046e3
7 changed files with 83 additions and 13 deletions

View file

@ -370,6 +370,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 **/
var screenTip = {
@ -534,7 +542,7 @@ define([
}
}
/** coauthoring begin **/
else if (moveData.get_Type()==2 && me.mode.isEdit) { // 2 - locked object
else if (moveData.get_Type()==2 && me.mode.isEdit && isUserVisible(moveData.get_UserId())) { // 2 - locked object
var src;
if (me.usertipcount >= me.usertips.length) {
src = $(document.createElement("div"));
@ -568,6 +576,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++) {

View file

@ -1327,7 +1327,7 @@ define([
}
if (me.permissions.isEdit) {
if (index_locked) {
if (index_locked && me.isUserVisible(dataarray[index_locked-1].asc_getUserId())) {
data = dataarray[index_locked-1];
if (!coAuthTip.XY)
@ -1377,7 +1377,7 @@ define([
}
}
}
if (index_foreign) {
if (index_foreign && me.isUserVisible(dataarray[index_foreign-1].asc_getUserId())) {
data = dataarray[index_foreign-1];
if (!coAuthTip.XY)
@ -3807,6 +3807,8 @@ define([
},
onShowForeignCursorLabel: function(UserId, X, Y, color) {
if (!this.isUserVisible(UserId)) return;
/** coauthoring begin **/
var src;
var me = this;
@ -3863,6 +3865,16 @@ define([
return this.guestText;
},
isUserVisible: function(id){
var usersStore = SSE.getCollection('Common.Collections.Users');
if (usersStore){
var rec = usersStore.findUser(id);
if (rec)
return !rec.get('hidden');
}
return true;
},
SetDisabled: function(state, canProtect) {
this._isDisabled = state;
this._canProtect = canProtect;

View file

@ -286,7 +286,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
ruleChanged: false, // true if was edited in FormatRulesEditDlg or was created, need to send this rule to sdk if true
props: rule,
lock: (idlock!==null && idlock!==undefined),
lockuser: (idlock) ? this.getUserName(idlock) : this.guestText
lockuser: (idlock) ? (this.isUserVisible(idlock) ? this.getUserName(idlock) : this.lockText) : this.guestText
});
}
}
@ -816,7 +816,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
var store = this.rulesList.store,
rec = store.findWhere({ruleId: ruleId});
if (rec) {
rec.set('lockuser', (userId) ? this.getUserName(userId) : this.guestText);
rec.set('lockuser', (userId) ? (this.isUserVisible(userId) ? this.getUserName(userId) : this.lockText) : this.guestText);
rec.set('lock', true);
this.updateButtons();
}
@ -845,6 +845,16 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
return this.guestText;
},
isUserVisible: function(id){
var usersStore = SSE.getCollection('Common.Collections.Users');
if (usersStore){
var rec = usersStore.findUser(id);
if (rec)
return !rec.get('hidden');
}
return true;
},
txtTitle: 'Conditional Formatting',
textNew: 'New',
textEdit: 'Edit',
@ -886,7 +896,8 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
textDuplicate: 'Duplicate values',
textUnique: 'Unique values',
tipIsLocked: 'This element is being edited by another user.',
guestText: 'Guest'
guestText: 'Guest',
lockText: 'Locked'
}, SSE.Views.FormatRulesManagerDlg || {}));
});

View file

@ -206,7 +206,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
scopeName: (scope===null) ? this.textWorkbook: this.sheetNames[scope],
range: (type===Asc.c_oAscDefNameType.slicer) ? '' : this.ranges[i].asc_getRef(),
lock: (id!==null && id!==undefined),
lockuser: (id) ? this.getUserName(id) : this.guestText,
lockuser: (id) ? (this.isUserVisible(id) ? this.getUserName(id) : this.lockText) : this.guestText,
type: type,
isTable: type===Asc.c_oAscDefNameType.table,
isSlicer: type===Asc.c_oAscDefNameType.slicer
@ -386,6 +386,16 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
return this.guestText;
},
isUserVisible: function(id){
var usersStore = SSE.getCollection('Common.Collections.Users');
if (usersStore){
var rec = usersStore.findUser(id);
if (rec)
return !rec.get('hidden');
}
return true;
},
onSelectRangeItem: function(lisvView, itemView, record) {
if (!record) return;
@ -451,7 +461,8 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
textWorkbook: 'Workbook',
guestText: 'Guest',
tipIsLocked: 'This element is being edited by another user.',
warnDelete: 'Are you sure you want to delete the name {0}?'
warnDelete: 'Are you sure you want to delete the name {0}?',
lockText: 'Locked'
}, SSE.Views.NameManagerDlg || {}));
});

View file

@ -169,7 +169,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
range: ranges[i].asc_getSqref() || '',
props: ranges[i],
lock: (id!==null && id!==undefined),
lockuser: (id) ? this.getUserName(id) : this.guestText
lockuser: (id) ? (this.isUserVisible(id) ? this.getUserName(id) : this.lockText) : this.guestText
});
}
this.rangeList.store.reset(arr);
@ -334,6 +334,16 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
return this.guestText;
},
isUserVisible: function(id){
var usersStore = SSE.getCollection('Common.Collections.Users');
if (usersStore){
var rec = usersStore.findUser(id);
if (rec)
return !rec.get('hidden');
}
return true;
},
onSelectRangeItem: function(lisvView, itemView, record) {
if (!record) return;
@ -395,7 +405,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
var store = this.rulesList.store,
rec = store.findWhere({ruleId: ruleId});
if (rec) {
rec.set('lockuser', (userId) ? this.getUserName(userId) : this.guestText);
rec.set('lockuser', (userId) ? (this.isUserVisible(userId) ? this.getUserName(userId) : this.lockText) : this.guestText);
rec.set('lock', true);
this.updateButtons();
}
@ -438,7 +448,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
txtYes: 'Yes',
txtNo: 'No',
txtEditRange: 'Edit Range',
txtNewRange: 'New Range'
txtNewRange: 'New Range',
lockText: 'Locked'
}, SSE.Views.ProtectRangesDlg || {}));
});

View file

@ -192,7 +192,7 @@ define([
active: view.asc_getIsActive(),
view: view,
lock: (id!==null && id!==undefined),
lockuser: (id) ? this.getUserName(id) : this.guestText
lockuser: (id) ? (this.isUserVisible(id) ? this.getUserName(id) : this.lockText) : this.guestText
});
view.asc_getIsActive() && (active = i);
}
@ -315,6 +315,16 @@ define([
return this.guestText;
},
isUserVisible: function(id){
var usersStore = SSE.getCollection('Common.Collections.Users');
if (usersStore){
var rec = usersStore.findUser(id);
if (rec)
return !rec.get('hidden');
}
return true;
},
onSelectItem: function(lisvView, itemView, record) {
if (!record) return;
@ -374,7 +384,8 @@ define([
textRenameLabel: 'Rename view',
textRenameError: 'View name must not be empty.',
warnDeleteView: "You are trying to delete the currently enabled view '%1'.<br>Close this view and delete it?",
textLongName: 'Enter a name that is less than 128 characters.'
textLongName: 'Enter a name that is less than 128 characters.',
lockText: 'Locked'
}, SSE.Views.ViewManagerDlg || {}));
});

View file

@ -2292,6 +2292,7 @@
"SSE.Views.FormatRulesManagerDlg.textUp": "Move rule up",
"SSE.Views.FormatRulesManagerDlg.tipIsLocked": "This element is being edited by another user.",
"SSE.Views.FormatRulesManagerDlg.txtTitle": "Conditional Formatting",
"SSE.Views.FormatRulesManagerDlg.lockText": "Locked",
"SSE.Views.FormatSettingsDialog.textCategory": "Category",
"SSE.Views.FormatSettingsDialog.textDecimal": "Decimal",
"SSE.Views.FormatSettingsDialog.textFormat": "Format",
@ -2521,6 +2522,7 @@
"SSE.Views.NameManagerDlg.tipIsLocked": "This element is being edited by another user.",
"SSE.Views.NameManagerDlg.txtTitle": "Name Manager",
"SSE.Views.NameManagerDlg.warnDelete": "Are you sure you want to delete the name {0}?",
"SSE.Views.NameManagerDlg.lockText": "Locked",
"SSE.Views.PageMarginsDialog.textBottom": "Bottom",
"SSE.Views.PageMarginsDialog.textLeft": "Left",
"SSE.Views.PageMarginsDialog.textRight": "Right",
@ -2784,6 +2786,7 @@
"SSE.Views.ProtectRangesDlg.txtTitle": "Allow Users to Edit Ranges",
"SSE.Views.ProtectRangesDlg.txtYes": "Yes",
"SSE.Views.ProtectRangesDlg.warnDelete": "Are you sure you want to delete the name {0}?",
"SSE.Views.ProtectRangesDlg.lockText": "Locked",
"SSE.Views.RemoveDuplicatesDialog.textColumns": "Columns",
"SSE.Views.RemoveDuplicatesDialog.textDescription": "To delete duplicate values, select one or more columns that contain duplicates.",
"SSE.Views.RemoveDuplicatesDialog.textHeaders": "My data has headers",
@ -3526,6 +3529,7 @@
"SSE.Views.ViewManagerDlg.tipIsLocked": "This element is being edited by another user.",
"SSE.Views.ViewManagerDlg.txtTitle": "Sheet View Manager",
"SSE.Views.ViewManagerDlg.warnDeleteView": "You are trying to delete the currently enabled view '%1'.<br>Close this view and delete it?",
"SSE.Views.ViewManagerDlg.lockText": "Locked",
"SSE.Views.ViewTab.capBtnFreeze": "Freeze Panes",
"SSE.Views.ViewTab.capBtnSheetView": "Sheet View",
"SSE.Views.ViewTab.textClose": "Close",