Skip to content

Commit

Permalink
fix: do not remove unknown taxonomies, hide them instead (#4420)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymarcon authored and meek0 committed Oct 4, 2023
1 parent 76a5364 commit bf9efc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,18 @@ public Taxonomy getTaxonomyTaxonomy() {
}
}

// check variable taxonomies to be removed from meta
// check variable taxonomies to be hidden in meta
List<String> reverseVariableTaxonomiesNames = variableTaxonomies.stream()
.map(TaxonomyEntity::getName).collect(Collectors.toList());
List<Term> newTerms = variableChars.getTerms().stream()
.filter(term -> "Mica_variable".equals(term.getName()) || reverseVariableTaxonomiesNames.contains(term.getName()))
List<Term> termsToHide = variableChars.getTerms().stream()
.filter(term -> !"Mica_variable".equals(term.getName()) && !reverseVariableTaxonomiesNames.contains(term.getName()))
.filter(term -> term.getAttributeValue("hidden") == null || term.getAttributeValue("hidden").equals("false"))
.collect(Collectors.toList());

List<Term> uniqueVariableCharsTerms = variableChars.getTerms().stream().distinct().collect(Collectors.toList());
if (newTerms.size() < variableChars.getTerms().size()) {
variableChars.setTerms(newTerms);
modified = true;
}

if (uniqueVariableCharsTerms.size() != newTerms.size()) {
variableChars.setTerms(uniqueVariableCharsTerms);
if (!termsToHide.isEmpty()) {
for (Term term : termsToHide) {
term.addAttribute("hidden", "true");
}
modified = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion mica-webapp/src/main/conf/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ opal:
password: password

agate:
url: https://localhost:8444
url: http://localhost:8081
application:
name: mica
key: changeit
Expand Down

0 comments on commit bf9efc7

Please sign in to comment.