Skip to content
Snippets Groups Projects
Commit 29ff2d3d authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

MAINT: Move getting username and role for better testing

parent 93ac2c77
Branches
Tags
2 merge requests!89Release v0.10.0,!86F hide properties
...@@ -51,10 +51,8 @@ var prop_display = new function ($, edit_mode, getEntityName, getEntityRole, get ...@@ -51,10 +51,8 @@ var prop_display = new function ($, edit_mode, getEntityName, getEntityRole, get
return $(".caosdb-entity-panel,.caosdb-entity-preview"); return $(".caosdb-entity-panel,.caosdb-entity-preview");
} }
this.unhideProperties = function (entities, conf, allTypes) { this.unhideProperties = function (entities, conf, allTypes, userName, userRoles) {
const userName = getUserName();
const userRoles = getUserRoles();
for (let ent of entities) { for (let ent of entities) {
let parents = getParents(ent).map(par => par.name); let parents = getParents(ent).map(par => par.name);
let properties = getPropertyElements(ent); let properties = getPropertyElements(ent);
...@@ -165,7 +163,9 @@ var prop_display = new function ($, edit_mode, getEntityName, getEntityRole, get ...@@ -165,7 +163,9 @@ var prop_display = new function ($, edit_mode, getEntityName, getEntityRole, get
original_return = original(entitiy); original_return = original(entitiy);
} }
var entities = prop_display.getEntitiesInView(); var entities = prop_display.getEntitiesInView();
prop_display.unhideProperties(entities, conf, allTypes); const userName = getUserName();
const userRoles = getUserRoles();
prop_display.unhideProperties(entities, conf, allTypes, userName, userRoles);
return original_return; return original_return;
} }
...@@ -177,7 +177,9 @@ var prop_display = new function ($, edit_mode, getEntityName, getEntityRole, get ...@@ -177,7 +177,9 @@ var prop_display = new function ($, edit_mode, getEntityName, getEntityRole, get
if (Object.keys(conf).length > 0) { if (Object.keys(conf).length > 0) {
const allTypes = await this._getRecordTypes(conf); const allTypes = await this._getRecordTypes(conf);
var entities = this.getEntitiesInView(); var entities = this.getEntitiesInView();
this.unhideProperties(entities, conf, allTypes); const userName = getUserName();
const userRoles = getUserRoles();
this.unhideProperties(entities, conf, allTypes, userName, userRoles);
// If we are in the edit mode, (un)hide properties after ending // If we are in the edit mode, (un)hide properties after ending
// the editing of an entity // the editing of an entity
document.body.addEventListener(edit_mode.start_edit.type, (e) => { document.body.addEventListener(edit_mode.start_edit.type, (e) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment