[CONTEDIT-552] Stories Multiblock "Others" button does not obey the yaml definition Created: 01/Jun/23 Updated: 14/Dec/23 Resolved: 04/Dec/23 |
|
| Status: | Closed |
| Project: | Content Editor |
| Component/s: | None |
| Affects Version/s: | 2.1.4 |
| Fix Version/s: | 2.1.8 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Jordan Elmore | Assignee: | Miguel Martinez |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 0.25d | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Template: | |||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||
| Task DoD: |
[X]*
Doc/release notes changes? Comment present?
[X]*
Downstream builds green?
[X]*
Solution information and context easily available?
[X]*
Tests
[X]*
FixVersion filled and not yet released
[X] 
Architecture Decision Record (ADR)
|
||||||||||||||||
| Bug DoR: |
[X]*
Steps to reproduce, expected, and actual results filled
[X]*
Affected version filled
|
||||||||||||||||
| Date of First Response: | |||||||||||||||||
| Visible to: |
Kenton Horton
|
||||||||||||||||
| Epic Link: | AuthorX Support | ||||||||||||||||
| Team: | |||||||||||||||||
| Work Started: | |||||||||||||||||
| Approved: |
Yes
|
||||||||||||||||
| Description |
Steps to reproduce
Expected resultsIt should only load the blocks defined in the yaml file Actual resultsIt loads all of the blocks registered in the system WorkaroundDevelopment notesUpon investigating this, I found that the others button is hard coded to load in every registered block in the system: //Add others menuItem.addItem(i18n.translate("blocks.picker.others"), MagnoliaIcons.ELLIPSIS, openOtherBlockChooserCommand(blockDefinitionConsumer, defaultBlock)); private MenuBar.Command openOtherBlockChooserCommand(Consumer<BlockDefinition<T>> blockDefinitionConsumer, String defaultBlock) { return item -> { BlockChooserDefinition blockChooserDefinition = new BlockChooserDefinition(); blockChooserDefinition.setOptions(buildAllRegisteredBlocksOptions()); blockChooserDefinition.setDefaultBlock(defaultBlock); blockChooserDefinition.setImplementationClass((Class) BlockChooser.class); blockChooserDefinition.setLabel(i18n.translate("stories.chooseDialog.label")); chooserController.openChooser(blockChooserDefinition) .thenAccept(chosenBlock -> chosenBlock.getChoice() .ifPresent(blockName -> addBlock(blockDefinitionConsumer, blockName))); }; } private Options buildAllRegisteredBlocksOptions() { Map<String, String> blockOptions = getAllRegisteredBlockDefinitions().stream() .filter(def -> StringUtils.isNotBlank(def.getLabel())) .collect(Collectors.toMap(BlockDefinition::getLabel, BlockDefinition::getName)); return new Options(blockOptions);
|